Ignore diagnostics not found exceptions (#12066)

This commit is contained in:
Paulus Schoutsen 2022-03-17 13:44:06 -07:00 committed by GitHub
parent 5247b2813f
commit ea19740f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,6 +33,7 @@ import {
fetchDiagnosticHandler,
getDeviceDiagnosticsDownloadUrl,
getConfigEntryDiagnosticsDownloadUrl,
DiagnosticInfo,
} from "../../../data/diagnostics";
import {
EntityRegistryEntry,
@ -219,11 +220,20 @@ export class HaConfigDevicePage extends LitElement {
}
let links = await Promise.all(
this._integrations(device, this.entries).map(async (entry) => {
this._integrations(device, this.entries).map(
async (entry): Promise<boolean | { link: string; domain: string }> => {
if (entry.state !== "loaded") {
return false;
}
const info = await fetchDiagnosticHandler(this.hass, entry.domain);
let info: DiagnosticInfo;
try {
info = await fetchDiagnosticHandler(this.hass, entry.domain);
} catch (err: any) {
if (err.code === "not_found") {
return false;
}
throw err;
}
if (!info.handlers.device && !info.handlers.config_entry) {
return false;
@ -234,7 +244,8 @@ export class HaConfigDevicePage extends LitElement {
: getConfigEntryDiagnosticsDownloadUrl(entry.entry_id),
domain: entry.domain,
};
})
}
)
);
links = links.filter(Boolean);