Created the error.js middleware

This commit is contained in:
Mathias Wagner
2023-02-19 13:09:51 +01:00
parent 86503f3f12
commit 868ebab6a1

View File

@@ -0,0 +1,5 @@
module.exports = (err, req, res, next) => {
if (!(err instanceof SyntaxError)) return next();
res.status(400).json({message: "You need to provide a valid JSON body"});
}