jws-backend/src/interfaces/http-error.ts

22 lines
393 B
TypeScript
Raw Normal View History

2024-04-01 13:28:43 +07:00
import HttpStatus from "./http-status";
class HttpError extends Error {
/**
* HTTP Status Code
*/
status: HttpStatus;
message: string;
2024-06-14 04:39:48 +00:00
code?: string;
2024-04-01 13:28:43 +07:00
2024-06-14 04:39:48 +00:00
constructor(status: HttpStatus, message: string, code?: string) {
2024-04-01 13:28:43 +07:00
super(message);
this.name = "HttpError";
this.status = status;
this.message = message;
2024-06-14 04:39:48 +00:00
this.code = code;
2024-04-01 13:28:43 +07:00
}
}
export default HttpError;