You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is one of the many examples i've seen that handles errors with AuthJs.
Neither of this is really covered in the docs, nor does it cover that AuthJs for some reason handles errors through multiple layers and error messages are returned at different levels for different error types.
So my question is: is this really how you recommend devs to handle errors? This seems quite absurd...
try{awaitsignIn(IdentityProvider.credentials.id,{
...parsedInput,redirectTo: redirectUrl ? redirectUrl : callbackUrl,redirect: true});}catch(error){// if (e instanceof CredentialsSignin) {// return returnValidationErrors(passThroughSignInSchema, {// _errors: [e.code]// });// }// throw e;if(errorinstanceofAuthError){constactualError=error.cause?.err;if(actualError){/** If the error is an unverified email error, redirect to the verify email page */if(isUnverifiedEmailError(actualError)){redirect(`${AppRoutes.VerifyEmail}?email=${parsedInput.email}?redirectOnSuccess=${AppRoutes.SignIn}`);}if(isRestrictedEntityError(error)){console.error("Restricted Entity Error:",error);throwerror;}}if(errorinstanceofCredentialsSignin){returnreturnValidationErrors(passThroughSignInSchema,{_errors: [error.code]});}// throw error;switch(error.type){case"CallbackRouteError":
thrownewError(String(error?.cause?.err));case"AccessDenied":
thrownewError(String(error?.cause?.err));default:
thrownewError(String(error?.cause?.err));}}else{if(isRedirectError(error)){console.error("Redirect Error:",error);// throw new Error("Redirect Error");}else{throwerror;}}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi AuthJs maintainers,
Below is one of the many examples i've seen that handles errors with AuthJs.
Neither of this is really covered in the docs, nor does it cover that AuthJs for some reason handles errors through multiple layers and error messages are returned at different levels for different error types.
So my question is: is this really how you recommend devs to handle errors? This seems quite absurd...
Beta Was this translation helpful? Give feedback.
All reactions