Skip to content

Commit

Permalink
catch errors in script function
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgerstmayr committed Jul 16, 2023
1 parent 270d979 commit 76b899a
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions fava_dashboards/static/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,21 @@ class Panel {
}

static html(ledger, panel, elem) {
elem.innerHTML = Panel.runScript(ledger, panel);
try {
elem.innerHTML = Panel.runScript(ledger, panel);
} catch (e) {
elem.innerHTML = e;
}
}

static echarts(ledger, panel, elem) {
const options = Panel.runScript(ledger, panel);
let options;
try {
options = Panel.runScript(ledger, panel);
} catch (e) {
elem.innerHTML = e;
return;
}

const chart = echarts.init(elem);
if (options.onClick) {
Expand All @@ -76,7 +86,14 @@ class Panel {
}

static d3_sankey(ledger, panel, elem) {
const options = Panel.runScript(ledger, panel);
let options;
try {
options = Panel.runScript(ledger, panel);
} catch (e) {
elem.innerHTML = e;
return;
}

render_d3sankey(elem, options);
}

Expand Down

0 comments on commit 76b899a

Please sign in to comment.