| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1x 1x 8x 8x 8x | import { BaseError } from './baseError';
export class NotFoundError extends BaseError {
constructor(message: string = 'Not Found', status: number = 404) {
// Calling parent constructor of base Error class.
super(message, status, 'not_found_error');
// Capturing stack trace, excluding constructor call from it.
Error.captureStackTrace(this, this.constructor);
// Saving class name in the property of our custom error as a shortcut.
this.name = this.constructor.name;
}
}
|