added ternary operator check status

This commit is contained in:
Dharmaraj 2021-07-26 19:43:49 +05:30
parent 1ae537e288
commit 88ef4ba920

View file

@ -5,21 +5,16 @@ class MonkeyError {
constructor(status, message, stack = null, uid) {
this.status = status ?? 500;
this.errorID = uuid.v4();
if (this.status === 500) {
this.message =
process.env.MODE === "dev"
? stack
? String(stack)
: String(message)
: "Internal Server Error " + this.errorID;
} else {
this.message =
process.env.MODE === "dev"
? stack
? String(stack)
this.message =
process.env.MODE === "dev"
? stack
? String(stack)
: this.status === 500
? String(message)
: message
: message;
}
: "Internal Server Error " + this.errorID;
console.log("Error", message, stack);
if (process.env.MODE !== "dev" && this.status === 500) {
mongoDB()