Loading web/src/errors/UnautherizedError.ts 0 → 100644 +31 −0 Original line number Diff line number Diff line import { CustomError } from "./CustomError"; export default class UnauthorizedError extends CustomError { private static readonly _statusCode = 401; private readonly _code: number; private readonly _logging: boolean; private readonly _context: { [key: string]: any }; constructor(params?: { code?: number; message?: string; logging?: boolean; context?: { [key: string]: any } }) { const { code, message, logging } = params || {}; super(message || "You are not authorized"); this._code = code || UnauthorizedError._statusCode; this._logging = logging || false; this._context = params?.context || {}; Object.setPrototypeOf(this, UnauthorizedError.prototype); } get errors() { return [{ message: this.message, context: this._context }]; } get statusCode() { return this._code; } get logging() { return this._logging; } } Loading
web/src/errors/UnautherizedError.ts 0 → 100644 +31 −0 Original line number Diff line number Diff line import { CustomError } from "./CustomError"; export default class UnauthorizedError extends CustomError { private static readonly _statusCode = 401; private readonly _code: number; private readonly _logging: boolean; private readonly _context: { [key: string]: any }; constructor(params?: { code?: number; message?: string; logging?: boolean; context?: { [key: string]: any } }) { const { code, message, logging } = params || {}; super(message || "You are not authorized"); this._code = code || UnauthorizedError._statusCode; this._logging = logging || false; this._context = params?.context || {}; Object.setPrototypeOf(this, UnauthorizedError.prototype); } get errors() { return [{ message: this.message, context: this._context }]; } get statusCode() { return this._code; } get logging() { return this._logging; } }