add error helper class

This commit is contained in:
rafiarrafif
2025-05-10 01:23:07 +07:00
parent 83f30bd36c
commit 954d40df3b
3 changed files with 24 additions and 3 deletions

View 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);
}
}