Skip to content

Commit

Permalink
Add try-catch around call that throws in ctor (#155224)
Browse files Browse the repository at this point in the history
Add try-catch around call that throws in ctor (#151147)
  • Loading branch information
alexdima authored and jrieken committed Jul 18, 2022
1 parent 263fbe2 commit b7093a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vs/workbench/api/browser/mainThreadTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 }) => {
Expand Down

0 comments on commit b7093a3

Please sign in to comment.