typenexus
Version:
TypeNexus is a good tool for API encapsulation and management. It provides a clean and lightweight way to package TypeORM functionality, helping you build applications faster while reducing template code redundancy and type conversion work.
17 lines (14 loc) • 549 B
text/typescript
import { Action } from '../Action.js';
import { UnauthorizedError } from './UnauthorizedError.js';
/**
* Thrown when authorization is required thought @CurrentUser decorator.
*/
export class AuthorizationRequiredError extends UnauthorizedError {
name = 'AuthorizationRequiredError';
constructor(action: Action) {
super();
Object.setPrototypeOf(this, AuthorizationRequiredError.prototype);
const uri = `${action.request.method} ${action.request.url}`;
this.message = `Authorization is required for request on "${uri}"`;
}
}