fix: change dev message to code

This commit is contained in:
puriphat 2024-06-14 04:39:48 +00:00
parent ddec8275d8
commit 9722fab149
2 changed files with 6 additions and 15 deletions

View file

@ -1,29 +1,20 @@
import HttpStatus from "./http-status";
type DevMessage =
| "missing_or_invalid_parameter"
| "data_exists"
| "data_in_used"
| "no_permission"
| "unknown_url"
| "data_not_found"
| "unauthorized";
class HttpError extends Error {
/**
* HTTP Status Code
*/
status: HttpStatus;
message: string;
devMessage?: DevMessage;
code?: string;
constructor(status: HttpStatus, message: string, devMessage?: DevMessage) {
constructor(status: HttpStatus, message: string, code?: string) {
super(message);
this.name = "HttpError";
this.status = status;
this.message = message;
this.devMessage = devMessage;
this.code = code;
}
}