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

Handle the case when one widget model fails to be created #935

Merged
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
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