mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-12 23:46:22 +00:00
fix: error handler
This commit is contained in:
parent
3d9c400cab
commit
c905728c70
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user