Add cancel to typescript promise rejection (#138333)

Fixes #138269
This commit is contained in:
Alex Ross 2021-12-02 15:21:29 +01:00 committed by GitHub
parent 93347ca210
commit e228f2a2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1059,11 +1059,13 @@ function getDignosticsKind(event: Proto.Event) {
}
class ServerInitializingIndicator extends Disposable {
private _task?: { project: string | undefined, resolve: () => void, reject: () => void };
private _task?: { project: string | undefined, resolve: () => void, reject: (error: Error) => void };
public reset(): void {
if (this._task) {
this._task.reject();
const error = new Error('Canceled');
error.name = error.message;
this._task.reject(error);
this._task = undefined;
}
}