- Refactored the spell id check

This commit is contained in:
Alexis
2020-05-16 21:32:27 +02:00
parent 7195b4359b
commit 8749020c73

View File

@@ -144,14 +144,10 @@ router.param('id', (req, res, next, id) => {
if (regex.test(id)) { if (regex.test(id)) {
next() next()
} else { } else {
let err = { throw new HttpError(403, 'Provided ID must be an integer')
name: "InvalidParameterException",
description: "The parameter is not valid. It should be an integer."
}
throw err
} }
} catch (err) { } catch (err) {
res.status(403).send(err) res.status(err.code).send(err.message)
} }
}) })