From df3f1768f73c0eaebbf7a784a2ac4bc3fe8028b6 Mon Sep 17 00:00:00 2001 From: Amir Omidi Date: Thu, 6 Feb 2020 13:42:01 -0800 Subject: [PATCH] Show error to user (#9014) * Show error to user * Update the errors * change message --- .../src/account-provider/azureAccountProvider2.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/azurecore/src/account-provider/azureAccountProvider2.ts b/extensions/azurecore/src/account-provider/azureAccountProvider2.ts index 6fd1ff3fc0..2153aae5fd 100644 --- a/extensions/azurecore/src/account-provider/azureAccountProvider2.ts +++ b/extensions/azurecore/src/account-provider/azureAccountProvider2.ts @@ -79,7 +79,9 @@ export class AzureAccountProvider implements azdata.AccountProvider { context.cache.add([response], (err, result) => { if (err || !result) { - console.log(`Unexpected error adding token to cache ${err}`); + const msg = localize('azure.tokenCacheFail', "Unexpected error adding token to cache: {0}", err.message); + vscode.window.showErrorMessage(msg); + console.log(err); } }); @@ -287,7 +289,9 @@ export class AzureAccountProvider implements azdata.AccountProvider { try { graphToken = await this.getToken(userId, value.tenantId, this.metadata.settings.graphResource.id); } catch (ex) { - console.log(`Your authentication to the tenant ${value.tenantId} failed: ${ex}`); + const msg = localize('azure.authFail', "Your authentication to the tenant {0} failed: {1}", value.tenantId, ex); + vscode.window.showErrorMessage(msg); + console.log(msg); return undefined; } @@ -308,7 +312,9 @@ export class AzureAccountProvider implements azdata.AccountProvider { tenants = tenants.filter(t => t !== undefined); if (tenants.length === 0) { - throw new Error(localize('azure.noTenants', "No azure tenants found. Failing...")); + const msg = localize('azure.noTenants', "Failed to add account. No Azure tenants."); + vscode.window.showErrorMessage(msg); + throw new Error(msg); } if (homeTenant) {