|
|
@@ -41,7 +41,7 @@ module.exports = {
|
|
|
return res.json(err);
|
|
|
}
|
|
|
if(err.name === "ValidationError"){
|
|
|
- return res.json(err.errors.name.properties.message);
|
|
|
+ return res.json(err.errors[Object.keys(err.errors)[0]].properties.message);
|
|
|
}
|
|
|
return res.json("ERROR: UNABLE TO SAVE INGREDIENT");
|
|
|
});
|
|
|
@@ -96,7 +96,7 @@ module.exports = {
|
|
|
return res.json(err);
|
|
|
}
|
|
|
if(err.name === "ValidationError"){
|
|
|
- return res.json(err.errors.name.properties.message);
|
|
|
+ return res.json(err.errors[Object.keys(err.errors)[0]].properties.message);
|
|
|
}
|
|
|
return res.json("ERROR: UNABLE TO UPDATE RECIPE");
|
|
|
});
|
|
|
@@ -137,7 +137,7 @@ module.exports = {
|
|
|
return res.json(err);
|
|
|
}
|
|
|
if(err.name === "ValidationError"){
|
|
|
- return res.json(err.errors.name.properties.message);
|
|
|
+ return res.json(err.errors[Object.keys(err.errors)[0]].properties.message);
|
|
|
}
|
|
|
return res.json("ERROR: UNABLE TO RETRIEVE USER DATA");
|
|
|
});
|
|
|
@@ -209,7 +209,7 @@ module.exports = {
|
|
|
return res.json(err);
|
|
|
}
|
|
|
if(err.name === "ValidationError"){
|
|
|
- return res.json(err.errors.name.properties.message);
|
|
|
+ return res.json(err.errors[Object.keys(err.errors)[0]].properties.message);
|
|
|
}
|
|
|
return res.json("ERROR: UNABLE TO RETRIEVE MERCHANT DATA");
|
|
|
});
|
|
|
@@ -306,7 +306,7 @@ module.exports = {
|
|
|
return res.json(err);
|
|
|
}
|
|
|
if(err.name === "ValidationError"){
|
|
|
- return res.json(err.errors.name.properties.message);
|
|
|
+ return res.json(err.errors[Object.keys(err.errors)[0]].properties.message);
|
|
|
}
|
|
|
return res.json("ERROR: UNABLE TO RETRIEVE RECIPE DATA FROM SQUARE");
|
|
|
});
|
|
|
@@ -416,7 +416,7 @@ module.exports = {
|
|
|
return res.json(err);
|
|
|
}
|
|
|
if(err.name === "ValidationError"){
|
|
|
- return res.json(err.errors.name.properties.message);
|
|
|
+ return res.json(err.errors[Object.keys(err.errors)[0]].properties.message);
|
|
|
}
|
|
|
return res.json("ERROR: UNABLE TO CREATE YOUR INGREDIENTS");
|
|
|
});
|