Skip to content

Commit

Permalink
Merge pull request #935 from martinRenou/handle_widget_model_creation…
Browse files Browse the repository at this point in the history
…_error

Handle the case when one widget model fails to be created
  • Loading branch information
jtpio committed Sep 1, 2021
2 parents 47cdccd + 4b2e828 commit d0b2e82
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions packages/voila/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,23 @@ export class WidgetManager extends JupyterLabManager {
await Promise.all(
widgets_info.map(async widget_info => {
const state = (widget_info as any).msg.content.data.state;
const modelPromise = this.new_model(
{
model_name: state._model_name,
model_module: state._model_module,
model_module_version: state._model_module_version,
comm: (widget_info as any).comm
},
state
);
const model = await modelPromise;
models[model.model_id] = model;
return modelPromise;
try {
const modelPromise = this.new_model(
{
model_name: state._model_name,
model_module: state._model_module,
model_module_version: state._model_module_version,
comm: (widget_info as any).comm
},
state
);
const model = await modelPromise;
models[model.model_id] = model;
} catch (error) {
// Failed to create a widget model, we continue creating other models so that
// other widgets can render
console.error(error);
}
})
);
return models;
Expand Down

0 comments on commit d0b2e82

Please sign in to comment.