improve account and tenant selection error handling (#17476)

* improve account/tenant selection error handling

* remove extra space from user string
This commit is contained in:
brian-harris
2021-10-25 12:26:38 -07:00
committed by GitHub
parent 8230d39120
commit aa0e52c245
4 changed files with 25 additions and 9 deletions

View File

@@ -92,10 +92,19 @@ export function accountLinkedMessage(count: number): string {
}
export const AZURE_TENANT = localize('sql.migration.azure.tenant', "Azure AD tenant");
export function ACCOUNT_STALE_ERROR(account: AzureAccount) {
return localize('azure.accounts.accountStaleError', "The access token for selected account '{0}' is no longer valid. Select 'Link account' and refresh the account, or select a different account.", `${account.displayInfo.displayName} (${account.displayInfo.userId})`);
return localize(
'azure.accounts.accountStaleError',
"The access token for selected account '{0}' and tenant '{1}' is no longer valid. Select 'Link account' and refresh the account, or select a different account.",
`${account?.displayInfo?.displayName} (${account?.displayInfo?.userId})`,
`${account?.properties?.tenants[0]?.displayName} (${account?.properties?.tenants[0]?.userId})`);
}
export function ACCOUNT_ACCESS_ERROR(account: AzureAccount, error: Error) {
return localize('azure.accounts.accountAccessError', "An error occurred while accessing the selected account '{0}'. Select 'Link account' and refresh the account, or select a different account. Error '{1}'", `${account.displayInfo.displayName} (${account.displayInfo.userId})`, error.message);
return localize(
'azure.accounts.accountAccessError',
"An error occurred while accessing the selected account '{0}' and tenant '{1}'. Select 'Link account' and refresh the account, or select a different account. Error '{2}'",
`${account?.displayInfo?.displayName} (${account?.displayInfo?.userId})`,
`${account?.properties?.tenants[0]?.displayName} (${account?.properties?.tenants[0]?.userId})`,
error.message);
}
// database backup page