feat: better error handling in forgotPassword trpc router

This commit is contained in:
Ephraim Atta-Duncan
2023-09-18 14:41:24 +00:00
committed by Mythie
parent 9b025f0c9f
commit 1e0cde850a

View File

@ -69,13 +69,16 @@ export const profileRouter = router({
email, email,
}); });
} catch (err) { } catch (err) {
console.error(err); let message =
'We were unable to update your profile. Please review the information you provided and try again.';
if (err instanceof Error) {
message = err.message;
}
// TODO: Handle this error better
throw new TRPCError({ throw new TRPCError({
code: 'BAD_REQUEST', code: 'BAD_REQUEST',
message: message,
'We were unable to update your profile. Please review the information you provided and try again.',
}); });
} }
}), }),