From 0f5a03ff60f8a22744b3e311c381a71269f4f2e9 Mon Sep 17 00:00:00 2001 From: Mindfreeze Date: Tue, 31 Oct 2023 18:18:02 +0100 Subject: [PATCH] fix(#121): fix for hidden error msg --- src/chart.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/chart.ts b/src/chart.ts index 7289cde..d0db952 100644 --- a/src/chart.ts +++ b/src/chart.ts @@ -33,6 +33,7 @@ export class Chart extends LitElement { @state() private highlightedEntities: EntityConfigInternal[] = []; @state() private lastUpdate = 0; @state() public zoomEntity?: EntityConfigInternal; + @state() public error?: Error; // https://lit.dev/docs/components/lifecycle/#reactive-update-cycle-performing protected shouldUpdate(changedProps: PropertyValues): boolean { @@ -86,7 +87,8 @@ export class Chart extends LitElement { ent.children.forEach(childId => { const child = this.config.sections[sectionIndex + 1]?.entities.find(e => e.entity_id === childId); if (!child) { - throw new Error(localize('common.missing_child') + ' ' + childId); + this.error = new Error(localize('common.missing_child') + ' ' + childId); + throw this.error; } const connection: ConnectionState = { parent: ent, @@ -447,6 +449,9 @@ export class Chart extends LitElement { // https://lit.dev/docs/components/rendering/ protected render(): TemplateResult | void { try { + if (this.error) { + throw this.error; + } this.entityStates.clear(); const containerClasses = classMap({ container: true,