Preview: forbidden-error.js
Size: 815 B
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/lib/backend/utils/errors/forbidden-error.js
import { ErrorTypeEnum } from '../../../utils/error-type.enum.js';
/**
* Error which is thrown when user
* doesn't have an access to a given resource/action.
*
* @category Errors
*/
export class ForbiddenError extends Error {
/**
* HTTP Status code: 403
*/
/**
* Base error message and type which is stored in the record
*/
/**
* Any custom message which should be seen in the UI
*/
/**
* @param {string} [message]
*/
constructor(message) {
const defaultMessage = 'You cannot perform this action';
super(defaultMessage);
this.statusCode = 403;
this.baseMessage = message;
this.baseError = {
message: message ?? defaultMessage,
type: ErrorTypeEnum.Forbidden
};
this.name = ErrorTypeEnum.Forbidden;
}
}
export default ForbiddenError;
Directory Contents
Dirs: 0 × Files: 8