Skip to content

Commit db9a594

Browse files
committed
Fixes red error msg
1 parent 03223b6 commit db9a594

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/cache/fetch-states.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ async function fetchStates(
3434
list = lists[0];
3535
} catch (e: any) {
3636
console.error(e);
37-
throw new Error(`Error fetching ${entity.entity}: ${e.msg}`);
37+
throw new Error(
38+
`Error fetching states of ${entity.entity}: ${JSON.stringify(
39+
e.message || ""
40+
)}`
41+
);
3842
}
3943
if (!list) list = []; //throw new Error(`Error fetching ${entity.entity}`); // shutup typescript
4044
return {

src/cache/fetch-statistics.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ async function fetchStatistics(
2020
statistics = (await statsP)[entity.entity];
2121
} catch (e: any) {
2222
console.error(e);
23-
throw new Error(`Error fetching ${entity.entity}: ${e.msg}`);
23+
throw new Error(
24+
`Error fetching statistics of ${entity.entity}: ${JSON.stringify(
25+
e.message || ""
26+
)}`
27+
);
2428
}
2529
if (!statistics) statistics = []; //throw new Error(`Error fetching ${entity.entity}`);
2630
return {

src/plotly-graph-card.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export class PlotlyGraph extends HTMLElement {
100100
#msg {
101101
position: absolute;
102102
color: red;
103+
top: 0;
103104
background: rgba(0, 0, 0, 0.4);
104105
}
105106
</style>
@@ -342,8 +343,8 @@ export class PlotlyGraph extends HTMLElement {
342343
);
343344
this.msgEl.innerText = "";
344345
} catch (e: any) {
345-
this.msgEl.innerText = e.message;
346346
console.error(e);
347+
this.msgEl.innerText = JSON.stringify(e.message || "");
347348
}
348349
await this.plot();
349350
};

0 commit comments

Comments
 (0)