- Refactored the spell id check
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user