routing-controllers
Version:
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
14 lines • 626 B
JavaScript
import { UnauthorizedError } from '../http-error/UnauthorizedError';
/**
* Thrown when authorization is required thought @CurrentUser decorator.
*/
export class AuthorizationRequiredError extends UnauthorizedError {
constructor(action) {
super();
this.name = 'AuthorizationRequiredError';
Object.setPrototypeOf(this, AuthorizationRequiredError.prototype);
const uri = `${action.request.method} ${action.request.url}`; // todo: check it it works in koa
this.message = `Authorization is required for request on ${uri}`;
}
}
//# sourceMappingURL=AuthorizationRequiredError.js.map