]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server.ts
Fix logging timestamp
[github/Chocobozzz/PeerTube.git] / server.ts
index dc7a71d608c2555e9edb648581234c7b8804ced7..c19ec4f194b7e01add2d3a112880af44cedf1734 100644 (file)
--- a/server.ts
+++ b/server.ts
@@ -158,8 +158,13 @@ app.use(function (req, res, next) {
 })
 
 app.use(function (err, req, res, next) {
-  logger.error(err, err)
-  res.sendStatus(err.status || 500)
+  let error = 'Unknown error.'
+  if (err) {
+    error = err.stack || err.message || err
+  }
+
+  logger.error('Error in controller.', { error })
+  return res.status(err.status || 500).end()
 })
 
 // ----------- Run -----------