feat: better error handling in forgotPassword trpc router

This commit is contained in:
Ephraim Atta-Duncan
2023-09-18 14:41:24 +00:00
parent 2327b15e0d
commit 45f447c796

View File

@ -69,13 +69,16 @@ export const profileRouter = router({
email,
});
} 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({
code: 'BAD_REQUEST',
message:
'We were unable to update your profile. Please review the information you provided and try again.',
message,
});
}
}),