From 5c93fa7edf47689788c694a5e7fffda5758c2412 Mon Sep 17 00:00:00 2001 From: Miodec Date: Fri, 3 Mar 2023 12:06:09 +0100 Subject: [PATCH] added better error to try to identify an issue --- backend/src/api/controllers/user.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/api/controllers/user.ts b/backend/src/api/controllers/user.ts index a7f6f5505..7de823537 100644 --- a/backend/src/api/controllers/user.ts +++ b/backend/src/api/controllers/user.ts @@ -84,7 +84,15 @@ export async function sendVerificationEmail( e.message.includes("TOO_MANY_ATTEMPTS_TRY_LATER") ) { // for some reason this error is not handled with a custom auth/ code, so we have to do it manually - throw new MonkeyError(429, "Too many requests. Please try again later."); + throw new MonkeyError(429, "Too many requests. Please try again later"); + } + if (e.code === "auth/user-not-found") { + throw new MonkeyError( + 500, + "Auth user not found when the user was found in the database", + JSON.stringify({ email: email, userInfoEmail: email, stack: e.stack }), + userInfo.uid + ); } throw e; }