Re-fix errorMiddleware (#3922)

lolsob-rspec
Takuya Yoshida 2017-06-26 08:46:15 +09:00 committed by Eugen Rochko
parent 104c7d7f96
commit 84d2df3ec6
1 changed files with 1 additions and 1 deletions

View File

@ -246,7 +246,7 @@ const startWorker = (workerId) => {
accountFromRequest(req, next);
};
const errorMiddleware = (err, req, res, next) => { // eslint-disable-line no-unused-vars
const errorMiddleware = (err, req, res, {}) => {
log.error(req.requestId, err.toString());
res.writeHead(err.statusCode || 500, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({ error: err.statusCode ? err.toString() : 'An unexpected error occurred' }));