We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 52d3e63 commit 10dbf2fCopy full SHA for 10dbf2f
src/index.js
@@ -44,15 +44,16 @@ const handler = (req, res) => {
44
if (err) {
45
// eslint-disable-next-line no-console
46
console.error(err);
47
- res.setHeader('Content-Type', 'application/json');
48
res.statusCode = err.status || err.statusCode || 500;
+ res.setHeader('Content-Type', 'application/json');
49
res.end(JSON.stringify({ error: err.message }));
50
return;
51
}
52
if (!res.finished) {
53
if (!res.headersSent) {
54
res.statusCode = 404;
55
56
57
res.end(JSON.stringify({ error: `'${req.url}' not found` }));
58
59
});
0 commit comments