mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Add error handling
This commit is contained in:
parent
5c0279bab8
commit
c33143b997
@ -4,6 +4,7 @@ import type { CSSResultGroup } from "lit";
|
|||||||
import { LitElement, css, html, nothing } from "lit";
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
|
import "../../components/ha-alert";
|
||||||
import "../../components/ha-dialog-header";
|
import "../../components/ha-dialog-header";
|
||||||
import "../../components/ha-icon-button";
|
import "../../components/ha-icon-button";
|
||||||
import "../../components/ha-md-dialog";
|
import "../../components/ha-md-dialog";
|
||||||
@ -29,6 +30,9 @@ class DialogRestartWait extends LitElement {
|
|||||||
|
|
||||||
private _actionOnIdle?: () => Promise<void>;
|
private _actionOnIdle?: () => Promise<void>;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private _error?: string;
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
private _backupState?: ManagerState;
|
private _backupState?: ManagerState;
|
||||||
|
|
||||||
@ -97,8 +101,16 @@ class DialogRestartWait extends LitElement {
|
|||||||
<span slot="title" .title=${this._title}> ${this._title} </span>
|
<span slot="title" .title=${this._title}> ${this._title} </span>
|
||||||
</ha-dialog-header>
|
</ha-dialog-header>
|
||||||
<div slot="content" class="content">
|
<div slot="content" class="content">
|
||||||
<ha-spinner></ha-spinner>
|
${this._error
|
||||||
${waitMessage}
|
? html`<ha-alert alert-type="error"
|
||||||
|
>${this.hass.localize("ui.dialogs.restart.error_backup_state", {
|
||||||
|
error: this._error,
|
||||||
|
})}</ha-alert
|
||||||
|
> `
|
||||||
|
: html`
|
||||||
|
<ha-spinner></ha-spinner>
|
||||||
|
${waitMessage}
|
||||||
|
`}
|
||||||
</div>
|
</div>
|
||||||
</ha-md-dialog>
|
</ha-md-dialog>
|
||||||
`;
|
`;
|
||||||
@ -125,10 +137,8 @@ class DialogRestartWait extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
// TODO show error to user
|
this._error = err.message || err;
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error(err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1543,6 +1543,7 @@
|
|||||||
"upload_in_progress": "A backup upload is currently in progress. The action will automatically proceed once the upload process is complete.",
|
"upload_in_progress": "A backup upload is currently in progress. The action will automatically proceed once the upload process is complete.",
|
||||||
"restore_in_progress": "A backup restore is currently in progress. The action will automatically proceed once the restore process is complete.",
|
"restore_in_progress": "A backup restore is currently in progress. The action will automatically proceed once the restore process is complete.",
|
||||||
"wait_for_backup": "Wait for the backup creation to finish",
|
"wait_for_backup": "Wait for the backup creation to finish",
|
||||||
|
"error_backup_state": "An error occured while getting the current backup state. Error: {error}",
|
||||||
"wait_for_upload": "Wait for backup upload to finish",
|
"wait_for_upload": "Wait for backup upload to finish",
|
||||||
"wait_for_restore": "Wait for backup restore to finish",
|
"wait_for_restore": "Wait for backup restore to finish",
|
||||||
"reload": {
|
"reload": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user