X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server.ts;h=c19ec4f194b7e01add2d3a112880af44cedf1734;hb=2b3b76abb0c363d85ff5c831afd541a9c6982e76;hp=529194a5ebd70535a9e67ca2d57d54108273274e;hpb=ac81d1a06d57b9ae86663831e7f5edcef57b0fa4;p=github%2FChocobozzz%2FPeerTube.git 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) { }) app.use(function (err, req, res, next) { - logger.error('Error in controller.', { error: err.stack || err.message || 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 -----------