aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server.ts')
-rw-r--r--server.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server.ts b/server.ts
index 529194a5e..c19ec4f19 100644
--- a/server.ts
+++ b/server.ts
@@ -158,8 +158,13 @@ app.use(function (req, res, next) {
158}) 158})
159 159
160app.use(function (err, req, res, next) { 160app.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 -----------