mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
Ignore error if we are not connected (#8472)
This commit is contained in:
parent
0bc2eb530d
commit
01e4414d17
@ -159,7 +159,11 @@ export class HassioUpdate extends LitElement {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Only show an error if the status code was not expected (user behind proxy)
|
// Only show an error if the status code was not expected (user behind proxy)
|
||||||
// or no status at all(connection terminated)
|
// or no status at all(connection terminated)
|
||||||
if (err.status_code && !ignoredStatusCodes.has(err.status_code)) {
|
if (
|
||||||
|
this.hass.connection.connected &&
|
||||||
|
err.status_code &&
|
||||||
|
!ignoredStatusCodes.has(err.status_code)
|
||||||
|
) {
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
title: "Update failed",
|
title: "Update failed",
|
||||||
text: extractApiErrorMessage(err),
|
text: extractApiErrorMessage(err),
|
||||||
|
@ -130,10 +130,12 @@ class DialogSupervisorCoreUpdate extends LitElement {
|
|||||||
try {
|
try {
|
||||||
await updateCore(this.hass);
|
await updateCore(this.hass);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (this.hass.connection.connected) {
|
||||||
this._error = extractApiErrorMessage(err);
|
this._error = extractApiErrorMessage(err);
|
||||||
this._action = null;
|
this._action = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fireEvent(this, "supervisor-colllection-refresh", { colllection: "core" });
|
fireEvent(this, "supervisor-colllection-refresh", { colllection: "core" });
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
}
|
}
|
||||||
|
@ -140,10 +140,12 @@ class HassioCoreInfo extends LitElement {
|
|||||||
try {
|
try {
|
||||||
await restartCore(this.hass);
|
await restartCore(this.hass);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (this.hass.connection.connected) {
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
title: "Failed to restart Home Assistant Core",
|
title: "Failed to restart Home Assistant Core",
|
||||||
text: extractApiErrorMessage(err),
|
text: extractApiErrorMessage(err),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
button.progress = false;
|
button.progress = false;
|
||||||
}
|
}
|
||||||
|
@ -342,11 +342,13 @@ class HassioHostInfo extends LitElement {
|
|||||||
await updateOS(this.hass);
|
await updateOS(this.hass);
|
||||||
fireEvent(this, "supervisor-colllection-refresh", { colllection: "os" });
|
fireEvent(this, "supervisor-colllection-refresh", { colllection: "os" });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if (this.hass.connection.connected) {
|
||||||
showAlertDialog(this, {
|
showAlertDialog(this, {
|
||||||
title: "Failed to update",
|
title: "Failed to update",
|
||||||
text: extractApiErrorMessage(err),
|
text: extractApiErrorMessage(err),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
button.progress = false;
|
button.progress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user