fix: change dev message to code
This commit is contained in:
parent
ddec8275d8
commit
9722fab149
2 changed files with 6 additions and 15 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue