mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Handle Promise errors caused by cancellation (#2420)
- Port of 34ca4c78b2
- This fixes issues where opening an editor send unhandled errors to the debug console, making it hard to debug issues.
This commit is contained in:
@@ -57,7 +57,7 @@ export class HoverOperation<Result> {
|
||||
private _firstWaitScheduler: RunOnceScheduler;
|
||||
private _secondWaitScheduler: RunOnceScheduler;
|
||||
private _loadingMessageScheduler: RunOnceScheduler;
|
||||
private _asyncComputationPromise: CancelablePromise<void>;
|
||||
private _asyncComputationPromise: CancelablePromise<Result>;
|
||||
private _asyncComputationPromiseDone: boolean;
|
||||
|
||||
private _completeCallback: (r: Result) => void;
|
||||
@@ -103,12 +103,11 @@ export class HoverOperation<Result> {
|
||||
|
||||
if (this._computer.computeAsync) {
|
||||
this._asyncComputationPromiseDone = false;
|
||||
this._asyncComputationPromise = createCancelablePromise(token => {
|
||||
return this._computer.computeAsync(token).then((asyncResult: Result) => {
|
||||
this._asyncComputationPromiseDone = true;
|
||||
this._withAsyncResult(asyncResult);
|
||||
}, (e) => this._onError(e));
|
||||
});
|
||||
this._asyncComputationPromise = createCancelablePromise(token => this._computer.computeAsync(token));
|
||||
this._asyncComputationPromise.then((asyncResult: Result) => {
|
||||
this._asyncComputationPromiseDone = true;
|
||||
this._withAsyncResult(asyncResult);
|
||||
}, (e) => this._onError(e));
|
||||
|
||||
} else {
|
||||
this._asyncComputationPromiseDone = true;
|
||||
|
||||
Reference in New Issue
Block a user