Skip to content

Commit f65823a

Browse files
committed
Adds more logging
1 parent 617df3b commit f65823a

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/webviews/webviewsController.ts

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ export class WebviewsController implements Disposable {
179179
if (token.isCancellationRequested) return;
180180
}
181181

182-
Logger.debug(scope, 'Resolving view');
182+
const instanceId = uuid();
183+
184+
Logger.debug(scope, `Resolving view (${instanceId})`);
183185

184186
webviewView.webview.options = {
185187
enableCommandUris: true,
@@ -194,7 +196,7 @@ export class WebviewsController implements Disposable {
194196
this.container,
195197
this._commandRegistrar,
196198
descriptor,
197-
uuid(),
199+
instanceId,
198200
webviewView,
199201
resolveProvider,
200202
);
@@ -204,7 +206,7 @@ export class WebviewsController implements Disposable {
204206

205207
disposables.push(
206208
controller.onDidDispose(() => {
207-
Logger.debug(scope, 'Disposing view');
209+
Logger.debug(scope, `Disposing view (${instanceId})`);
208210

209211
registration.pendingShowArgs = undefined;
210212
registration.controller = undefined;
@@ -218,8 +220,12 @@ export class WebviewsController implements Disposable {
218220
args = [{ state: context.state }];
219221
}
220222

221-
Logger.debug(scope, 'Showing view');
222-
await controller.show(true, options, ...(args ?? []));
223+
Logger.debug(scope, `Showing view (${instanceId})`);
224+
try {
225+
await controller.show(true, options, ...(args ?? []));
226+
} catch (ex) {
227+
Logger.error(ex, scope, `Failed to show view (${instanceId})`);
228+
}
223229
},
224230
},
225231
descriptor.webviewHostOptions != null ? { webviewOptions: descriptor.webviewHostOptions } : undefined,
@@ -366,10 +372,18 @@ export class WebviewsController implements Disposable {
366372
);
367373

368374
Logger.debug(scope, `Showing panel (${controller.instanceId})`);
369-
await controller.show(true, options, ...args);
375+
try {
376+
await controller.show(true, options, ...args);
377+
} catch (ex) {
378+
Logger.error(ex, scope, `Failed to show panel (${controller.instanceId})`);
379+
}
370380
} else {
371381
Logger.debug(scope, `Showing existing panel (${controller.instanceId})`);
372-
await controller.show(false, options, ...args);
382+
try {
383+
await controller.show(false, options, ...args);
384+
} catch (ex) {
385+
Logger.error(ex, scope, `Failed to show existing panel (${controller.instanceId})`);
386+
}
373387
}
374388
}
375389

0 commit comments

Comments
 (0)