if (err) {
error = err.stack || err.message || err
}
+
// Handling Sequelize error traces
- const sql = err.parent ? err.parent.sql : undefined
- logger.error('Error in controller.', { err: error, sql })
+ const sql = err?.parent ? err.parent.sql : undefined
+
+ // Help us to debug SequelizeConnectionAcquireTimeoutError errors
+ const activeRequests = err?.name === 'SequelizeConnectionAcquireTimeoutError' && typeof (process as any)._getActiveRequests !== 'function'
+ ? (process as any)._getActiveRequests()
+ : undefined
+
+ logger.error('Error in controller.', { err: error, sql, activeRequests })
return res.fail({
status: err.status || HttpStatusCode.INTERNAL_SERVER_ERROR_500,