Created the error middleware

This commit is contained in:
Mathias Wagner 2023-05-08 20:00:51 +02:00
parent 5c65842cae
commit b64bca6a81
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

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