diff options
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -158,8 +158,13 @@ app.use(function (req, res, next) { | |||
158 | }) | 158 | }) |
159 | 159 | ||
160 | app.use(function (err, req, res, next) { | 160 | app.use(function (err, req, res, next) { |
161 | logger.error('Error in controller.', { error: err.stack || err.message || err }) | 161 | let error = 'Unknown error.' |
162 | res.sendStatus(err.status || 500) | 162 | if (err) { |
163 | error = err.stack || err.message || err | ||
164 | } | ||
165 | |||
166 | logger.error('Error in controller.', { error }) | ||
167 | return res.status(err.status || 500).end() | ||
163 | }) | 168 | }) |
164 | 169 | ||
165 | // ----------- Run ----------- | 170 | // ----------- Run ----------- |