mirror of
https://github.com/usatiuk/ustk-todolist.git
synced 2025-10-28 23:57:49 +01:00
tidy up app.js
This commit is contained in:
5
app.js
5
app.js
@@ -77,21 +77,18 @@ app.use((error, req, res, next) => {
|
|||||||
case 'BadRequest':
|
case 'BadRequest':
|
||||||
case 'BadRequestError':
|
case 'BadRequestError':
|
||||||
res.status(400);
|
res.status(400);
|
||||||
res.json({ success: false, error });
|
|
||||||
break;
|
break;
|
||||||
case 'AuthenticationError':
|
case 'AuthenticationError':
|
||||||
case 'UnauthorizedError':
|
case 'UnauthorizedError':
|
||||||
res.status(401);
|
res.status(401);
|
||||||
res.json({ success: false, error });
|
|
||||||
break;
|
break;
|
||||||
case 'NotFound':
|
case 'NotFound':
|
||||||
res.status(404);
|
res.status(404);
|
||||||
res.json({ success: false, error });
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
res.status(500);
|
res.status(500);
|
||||||
res.json({ success: false, error });
|
|
||||||
}
|
}
|
||||||
|
res.json({ success: false, error });
|
||||||
if (
|
if (
|
||||||
process.env.NODE_ENV === 'production' ||
|
process.env.NODE_ENV === 'production' ||
|
||||||
process.env.NODE_ENV === 'test'
|
process.env.NODE_ENV === 'test'
|
||||||
|
|||||||
Reference in New Issue
Block a user