File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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' ) ;
You can’t perform that action at this time.
0 commit comments