Flatten connection login error handling

This commit is contained in:
Asier Isayas
2026-08-28 14:09:02 -07:00
parent 237391734c
commit b202bf9b7c
@@ -57,19 +57,21 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
setIsBlockedByFirewall(false);
setIsConnecting(true);
try {
try {
if (await isAccountRestrictedForConnectionStringLogin(connectionString)) {
setErrorMessage(
"This account has been blocked from connection-string login. Please go to cosmos.azure.com/aad for AAD based login.",
);
setIsConnecting(false);
return;
}
} catch (error) {
setErrorMessage(getErrorMessage(error as Error));
setIsConnecting(false);
return;
}
try {
if (isResourceTokenConnectionString(connectionString)) {
setAuthType(AuthType.ResourceToken);
return;
@@ -90,7 +92,6 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
}
// Mongo and Cassandra go through the Portal Backend
try {
const encryptedToken = await fetchEncryptedToken(connectionString);
setEncryptedToken(encryptedToken);
setAuthType(AuthType.ConnectionString);
@@ -106,7 +107,6 @@ export const ConnectExplorer: React.FunctionComponent<Props> = ({
// string is exchanged by the Portal Backend rather than the browser, so the account has
// to allowlist those services.
setIsBlockedByFirewall((error as Response).status === HttpStatusCodes.Forbidden);
}
} finally {
setIsConnecting(false);
}