fix: Substantially reduce cases where errors block whole card (#1764)

This commit is contained in:
Dermot Duffy
2024-12-15 20:39:18 -08:00
committed by GitHub
parent b6fb821074
commit dab9ff3045
25 changed files with 329 additions and 407 deletions
+10 -3
View File
@@ -12,7 +12,8 @@
import { css, CSSResultGroup, html, TemplateResult, unsafeCSS } from 'lit';
import { customElement } from 'lit/decorators.js';
import { query } from 'lit/decorators/query.js';
import { dispatchErrorMessageEvent } from '../components/message.js';
import { dispatchLiveErrorEvent } from '../components-lib/live/utils/dispatch-live-error.js';
import { renderMessage } from '../components/message.js';
import liveHAComponentsStyle from '../scss/live-ha-components.scss';
import { FrigateCardMediaPlayer } from '../types.js';
import { mayHaveAudio } from '../utils/audio.js';
@@ -97,8 +98,14 @@ customElements.whenDefined('ha-hls-player').then(() => {
protected render(): TemplateResult {
if (this._error) {
if (this._errorIsFatal) {
// Use native Frigate card error handling for fatal errors.
return dispatchErrorMessageEvent(this, this._error);
dispatchLiveErrorEvent(this);
return renderMessage({
type: 'error',
message: this._error,
context: {
entity_id: this.entityid,
},
});
} else {
errorToConsole(this._error, console.error);
}