mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
27 lines
581 B
TypeScript
27 lines
581 B
TypeScript
|
class NoAccessError extends Error {
|
||
|
permission: string;
|
||
|
|
||
|
name: string;
|
||
|
|
||
|
message: string;
|
||
|
|
||
|
constructor(permission: string) {
|
||
|
super();
|
||
|
Error.captureStackTrace(this, this.constructor);
|
||
|
|
||
|
this.name = this.constructor.name;
|
||
|
this.permission = permission;
|
||
|
this.message = `You need permission=${permission} to perform this action`;
|
||
|
}
|
||
|
|
||
|
toJSON(): any {
|
||
|
return {
|
||
|
permission: this.permission,
|
||
|
message: this.message,
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default NoAccessError;
|
||
|
module.exports = NoAccessError;
|