Skip to content

Commit 0f5a03f

Browse files
committed
fix(#121): fix for hidden error msg
1 parent f04557a commit 0f5a03f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/chart.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class Chart extends LitElement {
3333
@state() private highlightedEntities: EntityConfigInternal[] = [];
3434
@state() private lastUpdate = 0;
3535
@state() public zoomEntity?: EntityConfigInternal;
36+
@state() public error?: Error;
3637

3738
// https://lit.dev/docs/components/lifecycle/#reactive-update-cycle-performing
3839
protected shouldUpdate(changedProps: PropertyValues): boolean {
@@ -86,7 +87,8 @@ export class Chart extends LitElement {
8687
ent.children.forEach(childId => {
8788
const child = this.config.sections[sectionIndex + 1]?.entities.find(e => e.entity_id === childId);
8889
if (!child) {
89-
throw new Error(localize('common.missing_child') + ' ' + childId);
90+
this.error = new Error(localize('common.missing_child') + ' ' + childId);
91+
throw this.error;
9092
}
9193
const connection: ConnectionState = {
9294
parent: ent,
@@ -447,6 +449,9 @@ export class Chart extends LitElement {
447449
// https://lit.dev/docs/components/rendering/
448450
protected render(): TemplateResult | void {
449451
try {
452+
if (this.error) {
453+
throw this.error;
454+
}
450455
this.entityStates.clear();
451456
const containerClasses = classMap({
452457
container: true,

0 commit comments

Comments
 (0)