@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
33 lines (31 loc) • 825 B
JavaScript
;
//#region src/lib/errors/UserError.ts
/**
* 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
* @example
* ```typescript
* throw new UserError({
* identifier: 'AddArgumentError',
* message: 'You must write two numbers, but the second one did not match.',
* context: { received: 2, expected: 3 }
* });
* ```
*/
var UserError = class extends Error {
/**
* Constructs an UserError.
* @param options The UserError options
*/
constructor(options) {
super(options.message);
this.identifier = options.identifier;
this.context = options.context ?? null;
}
get name() {
return "UserError";
}
};
//#endregion
exports.UserError = UserError;
//# sourceMappingURL=UserError.cjs.map