mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 04:36:36 +00:00
Show toast with call service error (#8904)
This commit is contained in:
parent
ea60f7005b
commit
56fe4b07f3
@ -28,6 +28,7 @@ import { haStyle } from "../../../resources/styles";
|
|||||||
import "../../../styles/polymer-ha-style";
|
import "../../../styles/polymer-ha-style";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
import "../../../util/app-localstorage-document";
|
import "../../../util/app-localstorage-document";
|
||||||
|
import { showToast } from "../../../util/toast";
|
||||||
|
|
||||||
class HaPanelDevService extends LitElement {
|
class HaPanelDevService extends LitElement {
|
||||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||||
@ -267,11 +268,22 @@ class HaPanelDevService extends LitElement {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
private _callService() {
|
private async _callService() {
|
||||||
if (!this._serviceData?.service) {
|
if (!this._serviceData?.service) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
callExecuteScript(this.hass, [this._serviceData]);
|
try {
|
||||||
|
await callExecuteScript(this.hass, [this._serviceData]);
|
||||||
|
} catch (err) {
|
||||||
|
showToast(this, {
|
||||||
|
message:
|
||||||
|
this.hass.localize(
|
||||||
|
"ui.notification_toast.service_call_failed",
|
||||||
|
"service",
|
||||||
|
this._serviceData.service
|
||||||
|
) + ` ${err.message}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _toggleYaml() {
|
private _toggleYaml() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user