mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 10:05:57 +08:00
Show clear error when rendering VegaLite plot fails (#362)
This commit is contained in:
parent
6f724f7146
commit
9d4139529e
|
@ -36,9 +36,15 @@ const VegaLite = {
|
|||
spec.data = { values: [] };
|
||||
}
|
||||
|
||||
this.state.viewPromise = vegaEmbed(this.state.container, spec, {}).then(
|
||||
(result) => result.view
|
||||
);
|
||||
this.state.viewPromise = vegaEmbed(this.state.container, spec, {})
|
||||
.then((result) => result.view)
|
||||
.catch((error) => {
|
||||
const message = `Failed to render the given Vega-Lite specification, got the following error:\n\n ${error.message}\n\nMake sure to check for typos.`;
|
||||
|
||||
this.state.container.innerHTML = `
|
||||
<div class="text-red-600 whitespace-pre-wrap">${message}</div>
|
||||
`;
|
||||
});
|
||||
});
|
||||
|
||||
this.handleEvent(
|
||||
|
|
Loading…
Reference in a new issue