Skip to content

Commit 6f311f1

Browse files
dbg
1 parent 4fd01d1 commit 6f311f1

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

kernel/src/components/Dialog.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ export class Dialog {
5757
console.log("[Dialog] saveCard: Found notebook:", notebook.title.label);
5858
notebook.revealed.then(() => {
5959

60-
for (const cell of notebook.content.model.cells) {
61-
const shared_cell_mapping = cell.sharedModel;
62-
if (shared_cell_mapping.cell_type === 'code') {
63-
allCellContent += shared_cell_mapping.getSource() + '\n\n';
60+
if (notebook.content.model) {
61+
for (const cell of notebook.content.model.cells) {
62+
const shared_cell_mapping = cell.sharedModel;
63+
if (shared_cell_mapping.cell_type === 'code') {
64+
allCellContent += shared_cell_mapping.getSource() + '\n\n';
65+
}
6466
}
6567
}
6668

kernel/src/kernel.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,21 @@ export class EmbeddedKernel extends BaseKernel {
8484
const codeToSave = code.split(saveString)[1].trim();
8585
// pass the "stream" to the saveCodeToDevice method
8686
const result = await this.serviceContainer.saveCodeToDevice(codeToSave, this.outputResponse.bind(this));
87-
return result;
87+
if (result && result.status === 'ok') {
88+
return {
89+
status: 'ok',
90+
execution_count: this.executionCount,
91+
user_expressions: {},
92+
};
93+
} else {
94+
return {
95+
status: 'error',
96+
execution_count: this.executionCount,
97+
ename: result?.ename || 'SaveError',
98+
evalue: result?.evalue || 'Error saving code',
99+
traceback: result?.traceback || ['Error saving code'],
100+
};
101+
}
88102
}
89103

90104
try {

kernel/src/panel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default class WelcomePanel {
9494

9595
constructor(
9696
private serviceContainer: ServiceContainer,
97-
private app?: JupyterLiteServer
97+
private app: JupyterLiteServer
9898
) {
9999

100100
this.element = document.createElement('div');

0 commit comments

Comments
 (0)