Created the error middleware

This commit is contained in:
2023-05-08 20:00:51 +02:00
parent 5c65842cae
commit b64bca6a81

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"});
}