error = err.stack || err.message || err
}
- logger.error('Error in controller.', { err: error })
+ // Sequelize error
+ const sql = err.parent ? err.parent.sql : undefined
+
+ logger.error('Error in controller.', { err: error, sql })
return res.status(err.status || 500).end()
})
}
const consoleLoggerFormat = winston.format.printf(info => {
- let additionalInfos = JSON.stringify(info.meta || info.err, loggerReplacer, 2)
+ const obj = {
+ meta: info.meta,
+ err: info.err,
+ sql: info.sql
+ }
+
+ let additionalInfos = JSON.stringify(obj, loggerReplacer, 2)
if (additionalInfos === undefined || additionalInfos === '{}') additionalInfos = ''
else additionalInfos = ' ' + additionalInfos
logger.error('Cannot cache route.', { err })
return done(err)
})
+ } else {
+ done()
}
return sendSave(body)
return done()
})
} catch (err) {
- logger.error('Cannot serve cached route.', err)
+ logger.error('Cannot serve cached route.', { err })
return next()
}
}