diff --git a/src/sql/platform/accounts/common/interfaces.ts b/src/sql/platform/accounts/common/interfaces.ts index 301abcc740..4e3995e4de 100644 --- a/src/sql/platform/accounts/common/interfaces.ts +++ b/src/sql/platform/accounts/common/interfaces.ts @@ -35,7 +35,7 @@ export interface IAccountManagementService { beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Promise; endAutoOAuthDeviceCode(): void; cancelAutoOAuthDeviceCode(providerId: string): void; - copyUserCodeAndOpenBrowser(userCode: string, uri: string): void; + copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise; // SERVICE MANAGEMENT METHODS ///////////////////////////////////////// registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): void; diff --git a/src/sql/platform/accounts/test/common/testAccountManagementService.ts b/src/sql/platform/accounts/test/common/testAccountManagementService.ts index 263cb106ed..88f055d65b 100644 --- a/src/sql/platform/accounts/test/common/testAccountManagementService.ts +++ b/src/sql/platform/accounts/test/common/testAccountManagementService.ts @@ -35,8 +35,8 @@ export class TestAccountManagementService implements IAccountManagementService { return undefined; } - copyUserCodeAndOpenBrowser(userCode: string, uri: string): void { - return undefined; + async copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise { + return; } getAccountProviderMetadata(): Promise { diff --git a/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts b/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts index f204868be5..d3003281bc 100644 --- a/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts +++ b/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts @@ -21,7 +21,6 @@ import { localize } from 'vs/nls'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { URI } from 'vs/base/common/uri'; import { values } from 'vs/base/common/collections'; -import { onUnexpectedError } from 'vs/base/common/errors'; import { ILogService } from 'vs/platform/log/common/log'; import { INotificationService, Severity, INotification } from 'vs/platform/notification/common/notification'; import { Action } from 'vs/base/common/actions'; @@ -362,9 +361,10 @@ export class AccountManagementService implements IAccountManagementService { /** * Copy the user code to the clipboard and open a browser to the verification URI */ - public copyUserCodeAndOpenBrowser(userCode: string, uri: string): void { - this._clipboardService.writeText(userCode).catch(err => onUnexpectedError(err)); - this._openerService.open(URI.parse(uri)).catch(err => onUnexpectedError(err)); + public async copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise { + await this._clipboardService.writeText(userCode); + await this._openerService.open(URI.parse(uri)); + } private async _registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): Promise { diff --git a/src/sql/workbench/services/accountManagement/browser/autoOAuthDialogController.ts b/src/sql/workbench/services/accountManagement/browser/autoOAuthDialogController.ts index b3223676db..4d7974e1ee 100644 --- a/src/sql/workbench/services/accountManagement/browser/autoOAuthDialogController.ts +++ b/src/sql/workbench/services/accountManagement/browser/autoOAuthDialogController.ts @@ -72,9 +72,9 @@ export class AutoOAuthDialogController { this._providerId = undefined; } - private handleOnAddAccount(): void { + private async handleOnAddAccount(): Promise { if (this._userCode && this._uri) { - this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri); + return this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri); } else { throw new Error('Missing user code and uri'); }