Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function (error, req, res, next) {
typeof next; // handles linting issue
if (typeof error.code !== 'string') {
console.warn(error, error.stack);
error = log.CuvvaError.coerce(error);
log.warn('traditional_error', [error]);
}
// eslint-disable-next-line no-magic-numbers
res.status(errors[error.code] || 500);
res.json(snakecaseKeys(error));
}