Add try-catch around call that throws in ctor (#155224)

Add try-catch around call that throws in ctor (#151147)
This commit is contained in:
Alexandru Dima 2022-07-14 20:44:05 +02:00 committed by GitHub
parent 442f0bed1a
commit ef09cb02d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,7 @@ import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResu
import { IMainThreadTestController, ITestRootProvider, ITestService } from 'vs/workbench/contrib/testing/common/testService';
import { extHostNamedCustomer, IExtHostContext } from 'vs/workbench/services/extensions/common/extHostCustomers';
import { ExtHostContext, ExtHostTestingShape, ILocationDto, ITestControllerPatch, MainContext, MainThreadTestingShape } from '../common/extHost.protocol';
import { onUnexpectedError } from 'vs/base/common/errors';
@extHostNamedCustomer(MainContext.MainThreadTesting)
export class MainThreadTesting extends Disposable implements MainThreadTestingShape, ITestRootProvider {
@ -42,7 +43,13 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
const prevResults = resultService.results.map(r => r.toJSON()).filter(isDefined);
if (prevResults.length) {
this.proxy.$publishTestResults(prevResults);
try {
this.proxy.$publishTestResults(prevResults);
} catch (err) {
// See https://github.com/microsoft/vscode/issues/151147
// Trying to send more than 1GB of data can cause the method to throw.
onUnexpectedError(err);
}
}
this._register(this.testService.onDidCancelTestRun(({ runId }) => {