Handle undefined error when opening connection dialog (#21980)

* handle undefined error when opening connection dialog

* combine into else if

* change log

* update log message
This commit is contained in:
Christopher Suh
2023-02-17 15:22:51 -08:00
committed by GitHub
parent 7c47aea06e
commit 6231df85e0

View File

@@ -939,7 +939,11 @@ export class ConnectionWidget extends lifecycle.Disposable {
// If account was not filled in from received configuration, select the first account. // If account was not filled in from received configuration, select the first account.
this._azureAccountDropdown.select(0); this._azureAccountDropdown.select(0);
account = this._azureAccountList[0]; account = this._azureAccountList[0];
accountName = account.key.accountId; if (this._azureAccountList.length > 0) {
accountName = account.key.accountId;
} else {
this._logService.debug('fillInConnectionInputs: No accounts available');
}
} }
await this.onAzureAccountSelected(); await this.onAzureAccountSelected();
@@ -959,7 +963,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
this._azureTenantId = account.properties.tenants[0].id; this._azureTenantId = account.properties.tenants[0].id;
this.onAzureTenantSelected(0); this.onAzureTenantSelected(0);
} }
else { else if (accountName) {
this._logService.error(`fillInConnectionInputs : Could not find any tenants for account ${accountName}`); this._logService.error(`fillInConnectionInputs : Could not find any tenants for account ${accountName}`);
} }
}).catch(err => this._logService.error(`Unexpected error populating initial Azure Account options : ${err}`)); }).catch(err => this._logService.error(`Unexpected error populating initial Azure Account options : ${err}`));