refactor: add firebase 500 handling

This commit is contained in:
Miodec 2023-10-27 14:46:32 +01:00
parent 47c8668069
commit 8942ee2813

View file

@ -116,7 +116,7 @@ export async function sendVerificationEmail(
if (e.code === "auth/user-not-found") {
throw new MonkeyError(
500,
"Auth user not found when the user was found in the database",
"Auth user not found when the user was found in the database. Contact support with this error message and your email",
JSON.stringify({
decodedTokenEmail: email,
userInfoEmail: userInfo.email,
@ -125,6 +125,12 @@ export async function sendVerificationEmail(
userInfo.uid
);
}
if (e.message.includes("Internal error encountered.")) {
throw new MonkeyError(
500,
"Firebase failed to generate an email verification link. Please try again later."
);
}
throw e;
}