Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve notebook error logging #13256

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading