Reputation: 12989
I'm using the connect-timeout
module. When the timeout fires, it seems to dump the following error message to the console:
ServiceUnavailableError: Response timeout
at IncomingMessage.<anonymous> (/app/node_modules/connect-timeout/index.js:75:8)
at emitOne (events.js:96:13)
at IncomingMessage.emit (events.js:188:7)
at Timeout._onTimeout (/app/node_modules/connect-timeout/index.js:48:11)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
How do I suppress these log messages? I don't particularly want to see them, because the timeout firing is not really an indicator that there is a problem... it's just doing its job. And this is especially because I can add my own error handling middleware to express
that can pick and choose what (if anything) to do with the error.
Upvotes: 1
Views: 3254
Reputation: 432
You need to catch this from express, the code should look like:
function errorHandler (err, req, res, next) {
console.log("Oops")
}
app.use(errorHandler)
For more info: https://expressjs.com/en/guide/error-handling.html
Upvotes: 0