add error helper class
This commit is contained in:
13
src/helpers/error/handler/index.ts
Normal file
13
src/helpers/error/handler/index.ts
Normal file
@ -0,0 +1,13 @@
|
||||
export class AppError extends Error {
|
||||
public readonly statusCode: number;
|
||||
public readonly details?: any;
|
||||
|
||||
constructor(statusCode = 400, message: string, details?: any) {
|
||||
super(message);
|
||||
this.name = "AppError";
|
||||
this.statusCode = statusCode;
|
||||
this.details = details;
|
||||
|
||||
Object.setPrototypeOf(this, AppError.prototype);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user