mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Add error handling to device delete (#21403)
Currently, if device delete fails, the frontend stays silent. The user might get hints in the Core logs, but nothing shown on the frontend. This adds error handling similar to other places.
This commit is contained in:
parent
219f548261
commit
d997cfcef0
@ -999,11 +999,20 @@ export class HaConfigDevicePage extends LitElement {
|
||||
return;
|
||||
}
|
||||
|
||||
await removeConfigEntryFromDevice(
|
||||
this.hass!,
|
||||
this.deviceId,
|
||||
entry.entry_id
|
||||
);
|
||||
try {
|
||||
await removeConfigEntryFromDevice(
|
||||
this.hass!,
|
||||
this.deviceId,
|
||||
entry.entry_id
|
||||
);
|
||||
} catch (err: any) {
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.devices.error_delete"
|
||||
),
|
||||
text: err.message,
|
||||
});
|
||||
}
|
||||
},
|
||||
classes: "warning",
|
||||
icon: mdiDelete,
|
||||
|
@ -4068,6 +4068,7 @@
|
||||
"delete": "Delete",
|
||||
"confirm_delete": "Are you sure you want to delete this device?",
|
||||
"confirm_delete_integration": "Are you sure you want to remove this device from {integration}?",
|
||||
"error_delete": "Error deleting device",
|
||||
"picker": {
|
||||
"search": "Search {number} devices",
|
||||
"state": "State",
|
||||
|
Loading…
x
Reference in New Issue
Block a user