export class CustomError extends Error {
status = 400;
constructor(status: number, message: string) {
super(message);
this.status = status;
Object.setPrototypeOf(this, CustomError.prototype);
//error TS2550: Property 'setPrototypeOf' does not exist on type 'ObjectConstructor'.
//Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
}
getErrorMessage() {
return 'Something went wrong: ' + this.message;