improvement: better error handling

This commit is contained in:
canove
2020-09-04 17:09:39 -03:00
parent 3cb3fc1a20
commit f7fe3286b8
23 changed files with 166 additions and 532 deletions

View File

@@ -8,7 +8,7 @@ exports.store = async (req, res, next) => {
const user = await User.findOne({ where: { email: email } });
if (!user) {
return res.status(401).json({ error: "No user found with this email" });
return res.status(404).json({ error: "No user found with this email" });
}
if (!(await user.checkPassword(password))) {