From f54bb20fef6050c54a9d952a77200bf1e11115ca Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 27 Nov 2024 14:44:24 +0100 Subject: [PATCH] Fix error on hardware page (#23021) * fix error on hardware page * Update ha-config-hardware.ts --- src/panels/config/hardware/ha-config-hardware.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/panels/config/hardware/ha-config-hardware.ts b/src/panels/config/hardware/ha-config-hardware.ts index b4ebbb4afd..7d88ceb171 100644 --- a/src/panels/config/hardware/ha-config-hardware.ts +++ b/src/panels/config/hardware/ha-config-hardware.ts @@ -37,6 +37,7 @@ import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { hardwareBrandsUrl } from "../../../util/brands-url"; import { showhardwareAvailableDialog } from "./show-dialog-hardware-available"; +import { extractApiErrorMessage } from "../../../data/hassio/common"; const DATASAMPLES = 60; @@ -55,7 +56,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { @property({ type: Boolean }) public narrow = false; - @state() private _error?: { code: string; message: string }; + @state() private _error?: string; @state() private _OSData?: HassioHassOSInfo; @@ -268,11 +269,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { ` : ""} ${this._error - ? html` - ${this._error.message || this._error.code} - ` + ? html`${this._error}` : ""}
${boardName || isComponentLoaded(this.hass, "hassio") @@ -466,7 +463,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { this._OSData = await fetchHassioHassOsInfo(this.hass); } } catch (err: any) { - this._error = err.message || err; + this._error = extractApiErrorMessage(err); } }