better monkey error message

This commit is contained in:
Miodec 2021-08-18 01:15:26 +01:00
parent 1e6f90f60f
commit 719e8fb26c

View file

@ -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);
}
}
}
}