Skip to content

Commit 5aeb2d5

Browse files
author
Benjamin Pasero
committed
web extension debug - do not explode if connection is not there
1 parent f0d7286 commit 5aeb2d5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { IDebugHelperService } from 'vs/workbench/contrib/debug/common/debug';
1212
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
1313
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1414
import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
15+
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
16+
import { Event } from 'vs/base/common/event';
1517

1618
class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient {
1719

@@ -22,11 +24,16 @@ class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient {
2224
) {
2325
const connection = remoteAgentService.getConnection();
2426

25-
if (!connection) {
26-
throw new Error('Missing agent connection');
27+
let channel: IChannel;
28+
if (connection) {
29+
channel = connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName);
30+
} else {
31+
channel = { call: async () => undefined, listen: () => Event.None } as any;
32+
// TODO@weinand TODO@isidorn fallback?
33+
console.warn('Extension Host Debugging not available due to missing connection.');
2734
}
2835

29-
super(connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName));
36+
super(channel);
3037

3138
this._register(this.onReload(event => {
3239
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {

0 commit comments

Comments
 (0)