Fix more floating promises (#8374)

* Fix more floating promises

* Fix a few more

* Test fixes

* Fix spellings

* More promise fixes

* couple more

* Few more fixes

* One more missed one
This commit is contained in:
Charles Gagnon
2019-11-18 17:11:25 -08:00
committed by GitHub
parent 840683e3f0
commit 5b50696a1b
8 changed files with 231 additions and 348 deletions

View File

@@ -25,6 +25,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { onUnexpectedError } from 'vs/base/common/errors';
export class WizardModal extends Modal {
private _dialogPanes = new Map<WizardPage, DialogPane>();
@@ -139,13 +140,13 @@ export class WizardModal extends Modal {
this._wizard.onPageAdded(page => {
this.registerPage(page);
this.updatePageNumbers();
this.showPage(this._wizard.currentPage, false);
this.showPage(this._wizard.currentPage, false).catch(err => onUnexpectedError(err));
});
this._wizard.onPageRemoved(page => {
let dialogPane = this._dialogPanes.get(page);
this._dialogPanes.delete(page);
this.updatePageNumbers();
this.showPage(this._wizard.currentPage, false);
this.showPage(this._wizard.currentPage, false).catch(err => onUnexpectedError(err));
dialogPane.dispose();
});
this.updatePageNumbers();
@@ -168,7 +169,7 @@ export class WizardModal extends Modal {
private async showPage(index: number, validate: boolean = true, focus: boolean = false): Promise<void> {
let pageToShow = this._wizard.pages[index];
if (!pageToShow) {
this.done(validate);
this.done(validate).catch(err => onUnexpectedError(err));
return;
}
if (validate && !await this.validateNavigation(index)) {
@@ -235,8 +236,9 @@ export class WizardModal extends Modal {
}
public open(): void {
this.showPage(0, false, true);
this.show();
this.showPage(0, false, true).then(() => {
this.show();
}).catch(err => onUnexpectedError(err));
}
public async done(validate: boolean = true): Promise<void> {
@@ -281,19 +283,19 @@ export class WizardModal extends Modal {
/**
* Overridable to change behavior of escape key
*/
protected onClose(e: StandardKeyboardEvent) {
protected onClose(e: StandardKeyboardEvent): void {
this.cancel();
}
/**
* Overridable to change behavior of enter key
*/
protected onAccept(e: StandardKeyboardEvent) {
protected onAccept(e: StandardKeyboardEvent): void {
if (this._wizard.currentPage === this._wizard.pages.length - 1) {
this.done();
this.done().catch(err => onUnexpectedError(err));
} else {
if (this._nextButton.enabled) {
this.showPage(this._wizard.currentPage + 1, true, true);
this.showPage(this._wizard.currentPage + 1, true, true).catch(err => onUnexpectedError(err));
}
}
}