Fix more floating promises (#8460)

This commit is contained in:
Charles Gagnon
2019-11-27 08:04:51 -08:00
committed by GitHub
parent 4145ecfb32
commit 0e9797c394
14 changed files with 84 additions and 90 deletions

View File

@@ -23,6 +23,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';
const maxActions = 1;
@@ -66,7 +67,7 @@ export class ErrorMessageDialog extends Modal {
this.createCopyButton();
this._actionButtons = [];
for (let i = 0; i < maxActions; i++) {
this._actionButtons.unshift(this.createStandardButton('Action', () => this.onActionSelected(i)));
this._actionButtons.unshift(this.createStandardButton(localize('errorMessageDialog.action', "Action"), () => this.onActionSelected(i)));
}
this._okButton = this.addFooterButton(this._okLabel, () => this.ok());
this._register(attachButtonStyler(this._okButton, this._themeService));
@@ -74,7 +75,7 @@ export class ErrorMessageDialog extends Modal {
private createCopyButton() {
let copyButtonLabel = localize('copyDetails', "Copy details");
this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails), 'left');
this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails).catch(err => onUnexpectedError(err)), 'left');
this._copyButton.icon = 'codicon scriptToClipboard';
this._copyButton.element.title = copyButtonLabel;
this._register(attachButtonStyler(this._copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND, buttonForeground: SIDE_BAR_FOREGROUND }));
@@ -91,7 +92,7 @@ export class ErrorMessageDialog extends Modal {
this.ok();
// Run the action if possible
if (this._actions && index < this._actions.length) {
this._actions[index].run();
this._actions[index].run().catch(err => onUnexpectedError(err));
}
}