diff --git a/controllers/errorsController.js b/controllers/errorsController.js index 00e9ba6..260f306 100644 --- a/controllers/errorsController.js +++ b/controllers/errorsController.js @@ -13,8 +13,8 @@ const self = { self.handleError = (req, res, error) => { if (!res || res.headersSent) { - logger.error('Error: Unexpected missing "res" object or headers alredy sent.') - return logger.error(error) + logger.error(error) + return } res.header('Cache-Control', 'no-store') @@ -62,6 +62,8 @@ self.handleError = (req, res, error) => { } self.handleNotFound = (req, res) => { + if (!res || res.headersSent) return + res.header('Cache-Control', 'no-store') return res .status(404)