Monday 25 November 2019

console.log() ghost?

I have a application level middleware in my express app, which deals with all the errors processing. The problem is sometimes, I just cannot console.log() the error even though the program runs well. The below is the code: /* Global error handling */ app.use(async (err, req, res, next) => { console.log(err); //Ghost... const messages = [] const buttons = replyButtons("", ["Create Ticket", "Email Team", "Phone Call"], [], false) const list = replyList(`Error Message : ${err.message}`, "https://i.ibb.co/cyz5vBT/404-error.png", "", buttons) messages.push(list) await sendMessages.post(req.cid, messages) return res.status(500).send(err.message) }) Thanks!

Submitted November 26, 2019 at 04:59AM by PanJohn2019

No comments:

Post a Comment