mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-11 06:05:16 +08:00
catching errors while updating email
This commit is contained in:
parent
e5f2f705f2
commit
fdfc874ad7
1 changed files with 5 additions and 1 deletions
|
@ -93,7 +93,11 @@ class UserController {
|
|||
try {
|
||||
const { uid } = req.decodedToken;
|
||||
const { newEmail } = req.body;
|
||||
await UsersDAO.updateEmail(uid, newEmail);
|
||||
try {
|
||||
await UsersDAO.updateEmail(uid, newEmail);
|
||||
} catch (e) {
|
||||
throw new MonkeyError(400, e.message, "update email", uid);
|
||||
}
|
||||
Logger.log("user_email_updated", `changed email to ${newEmail}`, uid);
|
||||
return res.sendStatus(200);
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue