Show error to user (#9014)

* Show error to user

* Update the errors

* change message
This commit is contained in:
Amir Omidi
2020-02-06 13:42:01 -08:00
committed by GitHub
parent 343daf58fe
commit df3f1768f7

View File

@@ -79,7 +79,9 @@ export class AzureAccountProvider implements azdata.AccountProvider {
context.cache.add([response], (err, result) => { context.cache.add([response], (err, result) => {
if (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 { try {
graphToken = await this.getToken(userId, value.tenantId, this.metadata.settings.graphResource.id); graphToken = await this.getToken(userId, value.tenantId, this.metadata.settings.graphResource.id);
} catch (ex) { } 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; return undefined;
} }
@@ -308,7 +312,9 @@ export class AzureAccountProvider implements azdata.AccountProvider {
tenants = tenants.filter(t => t !== undefined); tenants = tenants.filter(t => t !== undefined);
if (tenants.length === 0) { 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) { if (homeTenant) {