Add better error handling for network failures in signIn
cgen-de39d44d0f384b259edd22ab96568a22
This commit is contained in:
parent
117850501b
commit
778bf63d09
1 changed files with 9 additions and 2 deletions
|
|
@ -155,11 +155,18 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||||
|
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
console.error("SignIn error details:", error);
|
||||||
|
|
||||||
|
let errorMessage = error.message;
|
||||||
|
if (error.message?.includes("Failed to fetch") || error.name === "AuthRetryableFetchError") {
|
||||||
|
errorMessage = "Unable to connect to authentication service. Please check your internet connection and try again.";
|
||||||
|
}
|
||||||
|
|
||||||
aethexToast.error({
|
aethexToast.error({
|
||||||
title: "Sign in failed",
|
title: "Sign in failed",
|
||||||
description: error.message,
|
description: errorMessage,
|
||||||
});
|
});
|
||||||
throw error;
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue