refactor(errors): add HttpError class and extend existing errors from it

This commit is contained in:
Panagiotis Papadopoulos
2025-03-07 22:47:03 +01:00
parent 39d45dc11b
commit 2c91f6e7bc
3 changed files with 24 additions and 8 deletions

View File

@@ -1,9 +1,10 @@
class ValidationError extends Error {
statusCode: number;
import HttpError from "./http_error.js";
class ValidationError extends HttpError {
constructor(message: string) {
super(message)
super(message, 400)
this.name = "ValidationError";
this.statusCode = 400;
}
}