@othree.io/excuses
Version:
Excuses
18 lines • 699 B
JavaScript
/**
* Custom Error class representing an unauthorized access error.
*/
export class UnauthorizedError extends Error {
/** Static error code to identify the error type. */
static ERROR = 'UnauthorizedError';
/**
* Creates a new UnauthorizedError.
*/
constructor() {
super('Unauthorized');
// https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
this.name = UnauthorizedError.ERROR;
this.stack = new Error().stack;
}
}
//# sourceMappingURL=unauthorized-error.js.map