Convert objects to string in config flow error (#11908)

This commit is contained in:
Bram Kragten 2022-03-03 13:55:40 +01:00 committed by GitHub
parent 24829bd903
commit 797c871137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,13 +117,17 @@ class DataEntryFlowDialog extends LitElement {
); );
} catch (err: any) { } catch (err: any) {
this.closeDialog(); this.closeDialog();
let message = err.message || err.body || "Unknown error";
if (typeof message !== "string") {
message = JSON.stringify(message);
}
showAlertDialog(this, { showAlertDialog(this, {
title: this.hass.localize( title: this.hass.localize(
"ui.panel.config.integrations.config_flow.error" "ui.panel.config.integrations.config_flow.error"
), ),
text: `${this.hass.localize( text: `${this.hass.localize(
"ui.panel.config.integrations.config_flow.could_not_load" "ui.panel.config.integrations.config_flow.could_not_load"
)}: ${err.message || err.body}`, )}: ${message}`,
}); });
return; return;
} }