Something went wrong. Try again.
because I got bored of customising my CV for every job
Something went wrong. Try again.
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445import { DomainError } from "./app-error";import { AuthorizationErrorCode } from "./error-codes";
export abstract class AuthorizationError extends DomainError {}
export class CannotViewError extends AuthorizationError { constructor(resourceType: string) { super( AuthorizationErrorCode.CANNOT_VIEW, `You are not authorized to view this ${resourceType}`, { resourceType }, ); }}
export class CannotCreateError extends AuthorizationError { constructor(resourceType: string) { super( AuthorizationErrorCode.CANNOT_CREATE, `You are not authorized to create ${resourceType}`, { resourceType }, ); }}
export class CannotUpdateError extends AuthorizationError { constructor(resourceType: string) { super( AuthorizationErrorCode.CANNOT_UPDATE, `You are not authorized to update this ${resourceType}`, { resourceType }, ); }}
export class CannotDeleteError extends AuthorizationError { constructor(resourceType: string) { super( AuthorizationErrorCode.CANNOT_DELETE, `You are not authorized to delete this ${resourceType}`, { resourceType }, ); }}