Skip to content

Commit

Permalink
Improve notebook error logging (#13256)
Browse files Browse the repository at this point in the history
  • Loading branch information
msujew authored Jan 16, 2024
1 parent b25357f commit 3569baa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ export class NotebookKernelHistoryService implements Disposable {
@inject(CommandService)
protected commandService: CommandService;

declare serviceBrand: undefined;

private static STORAGE_KEY = 'notebook.kernelHistory';
private mostRecentKernelsMap: KernelsList = {};
protected static STORAGE_KEY = 'notebook.kernelHistory';
protected mostRecentKernelsMap: KernelsList = {};

@postConstruct()
protected init(): void {
Expand Down Expand Up @@ -97,16 +95,16 @@ export class NotebookKernelHistoryService implements Disposable {
this.saveState();
}

private saveState(): void {
protected saveState(): void {
let notEmpty = false;
for (const [_, kernels] of Object.entries(this.mostRecentKernelsMap)) {
for (const kernels of Object.values(this.mostRecentKernelsMap)) {
notEmpty = notEmpty || Object.entries(kernels).length > 0;
}

this.storageService.setData(NotebookKernelHistoryService.STORAGE_KEY, notEmpty ? this.mostRecentKernelsMap : undefined);
}

private async loadState(): Promise<void> {
protected async loadState(): Promise<void> {
const kernelMap = await this.storageService.getData(NotebookKernelHistoryService.STORAGE_KEY);
if (kernelMap) {
this.mostRecentKernelsMap = kernelMap as KernelsList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ export class NotebookKernelQuickPickService {
return this.displaySelectAnotherQuickPick(editor, false);
}
} catch (ex) {
console.error('Failed to select notebook kernel', ex);
return false;
}
} else if (isKernelPick(selectedKernelPickItem)) {
Expand All @@ -370,6 +371,7 @@ export class NotebookKernelQuickPickService {
await selectedKernelPickItem.action.run(this.commandService);
return true;
} catch (ex) {
console.error('Failed to select notebook kernel', ex);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ export class NotebookKernelsExtImpl implements NotebookKernelsExt {
await obj.controller.executeHandler.call(obj.controller, cells, document.apiNotebook, obj.controller);
} catch (err) {
console.error(`NotebookController[${handle}] execute cells FAILED`, err);
console.error(err);
}

}
Expand Down

0 comments on commit 3569baa

Please sign in to comment.