mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
parent
2ce9b4e0c3
commit
1e26c64912
@ -26,13 +26,17 @@ const nameType = customJoi
|
||||
|
||||
const handleErrors = (res, logger, error) => {
|
||||
logger.warn(error.message);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
error.isJoi = true;
|
||||
switch (error.name) {
|
||||
case 'NotFoundError':
|
||||
return res.status(404).end();
|
||||
case 'NameExistsError':
|
||||
return res
|
||||
.status(409)
|
||||
.json(error)
|
||||
.end();
|
||||
case 'ValidationError':
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
error.isJoi = true;
|
||||
return res
|
||||
.status(400)
|
||||
.json(error)
|
||||
|
Loading…
Reference in New Issue
Block a user