@biskyjs/framework
Version:
43 lines • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserError = void 0;
/**
* The UserError class to be emitted in the pieces.
* @property name This will be `'UserError'` and can be used to distinguish the type of error when any error gets thrown
*/
class UserError extends Error {
/**
* Constructs an UserError.
* @param type The identifier, useful to localize emitted errors.
* @param message The error message.
*/
constructor(options) {
super(options.message);
/**
* An identifier, useful to localize emitted errors.
*/
Object.defineProperty(this, "identifier", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
/**
* User-provided context.
*/
Object.defineProperty(this, "context", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this.identifier = options.identifier;
this.context = options.context ?? null;
}
// eslint-disable-next-line @typescript-eslint/class-literal-property-style
get name() {
return "UserError";
}
}
exports.UserError = UserError;
//# sourceMappingURL=user.js.map