Skip to content
Snippets Groups Projects
Commit 0c44316b authored by Takuya Yoshida's avatar Takuya Yoshida Committed by Eugen Rochko
Browse files

Fix errorMiddleware to prevent "TypeError: res.writeHead is not a function" (#3913)

* Fix errorMiddleware

* Add "eslint-disable-line no-unused-vars"
parent 2211e8d1
No related branches found
No related tags found
No related merge requests found
......@@ -242,7 +242,7 @@ const startWorker = (workerId) => {
accountFromRequest(req, next);
};
const errorMiddleware = (err, req, res) => {
const errorMiddleware = (err, req, res, next) => { // eslint-disable-line no-unused-vars
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' }));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment