Skip to content

Commit 09bb4a3

Browse files
author
David Buezas
committed
don't crash on lambda errors
1 parent 343f626 commit 09bb4a3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/plotly-graph-card.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,16 @@ export class PlotlyGraph extends HTMLElement {
276276
let xs: Datum[] = xsIn;
277277
let ys = ysIn;
278278
if (trace.lambda) {
279-
const r = trace.lambda(ysIn, xsIn, history);
280-
if (Array.isArray(r)) {
281-
ys = r;
282-
} else {
283-
if (r.x) xs = r.x;
284-
if (r.y) ys = r.y;
279+
try {
280+
const r = trace.lambda(ysIn, xsIn, history);
281+
if (Array.isArray(r)) {
282+
ys = r;
283+
} else {
284+
if (r.x) xs = r.x;
285+
if (r.y) ys = r.y;
286+
}
287+
} catch (e){
288+
console.error(e)
285289
}
286290
}
287291
return merge(

0 commit comments

Comments
 (0)