feat: Add hardened error handling and retries (#2451)

- Closes #1830
 - Closes #2099
This commit is contained in:
Dermot Duffy
2026-06-30 17:45:12 -07:00
committed by dermotduffy
parent 4bc787e2b7
commit 47bcce93d3
182 changed files with 7877 additions and 4043 deletions
+10 -1
View File
@@ -1,4 +1,5 @@
import { format } from 'date-fns';
import { createNotificationFromError } from '../../components-lib/notification/factory';
import { homeAssistantGetSignedURLIfNecessary } from '../../ha/sign-path';
import { localize } from '../../localize/localize';
import { AdvancedCameraCardError } from '../../types';
@@ -37,7 +38,15 @@ export class ViewItemManager {
try {
await this._download(item);
} catch (error: unknown) {
this._api.getMessageManager().setErrorIfHigherPriority(error);
/* istanbul ignore if: catch always provides a non-null error -- @preserve */
if (error == null) {
return false;
}
this._api.getNotificationManager().setNotification(
createNotificationFromError(error, {
heading: { text: localize('error.download_failed'), icon: 'mdi:download-off' },
}),
);
return false;
}
return true;