mirror of
https://github.com/mastodon/mastodon
synced 2024-11-27 14:28:24 +09:00
Fix errorMiddleware to prevent "TypeError: res.writeHead is not a function" (#3913)
* Fix errorMiddleware * Add "eslint-disable-line no-unused-vars"
This commit is contained in:
parent
2211e8d1cd
commit
0c44316b22
@ -242,7 +242,7 @@ const startWorker = (workerId) => {
|
|||||||
accountFromRequest(req, next);
|
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());
|
log.error(req.requestId, err.toString());
|
||||||
res.writeHead(err.statusCode || 500, { 'Content-Type': 'application/json' });
|
res.writeHead(err.statusCode || 500, { 'Content-Type': 'application/json' });
|
||||||
res.end(JSON.stringify({ error: err.statusCode ? err.toString() : 'An unexpected error occurred' }));
|
res.end(JSON.stringify({ error: err.statusCode ? err.toString() : 'An unexpected error occurred' }));
|
||||||
|
Loading…
Reference in New Issue
Block a user