mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-04 04:51:16 +08:00
better monkey error message
This commit is contained in:
parent
1e6f90f60f
commit
719e8fb26c
1 changed files with 18 additions and 8 deletions
|
@ -5,14 +5,24 @@ class MonkeyError {
|
|||
this.status = status ?? 500;
|
||||
this.errorID = uuid.v4();
|
||||
this.stack = stack;
|
||||
this.message =
|
||||
process.env.MODE === "dev"
|
||||
? stack
|
||||
? String(stack)
|
||||
: this.status === 500
|
||||
? String(message)
|
||||
: message
|
||||
: "Internal Server Error " + this.errorID;
|
||||
// this.message =
|
||||
// process.env.MODE === "dev"
|
||||
// ? stack
|
||||
// ? String(stack)
|
||||
// : this.status === 500
|
||||
// ? String(message)
|
||||
// : message
|
||||
// : "Internal Server Error " + this.errorID;
|
||||
|
||||
if (process.env.MODE === "dev") {
|
||||
this.message = stack ? String(stack) : String(message);
|
||||
} else {
|
||||
if (this.stack) {
|
||||
this.message = "Internal Server Error " + this.errorID;
|
||||
} else {
|
||||
this.message = String(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue