Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (![[ValidationErrorName, 400], [NotFoundErrorName, 404], [ConflictErrorName, 409], [NotImplementedErrorName, 405], [UnauthorizedErrorName, 401]].some((p: [string, number]) => {
let [errorName, code] = p;
if (VError.findCauseByName(error, errorName)) {
res.status(code).json({
code: code,
message: error.message
})
return true
}
return false
})) {
// or pass the error down the chain