mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-26 14:27:20 +00:00
Handle config flow errors better (#11499)
* Handle config flow errors better * Use body for error message * Update dialog-data-entry-flow.ts
This commit is contained in:
parent
fb55ab197f
commit
54d6b5b6f3
@ -116,15 +116,14 @@ class DataEntryFlowDialog extends LitElement {
|
||||
params.continueFlowId
|
||||
);
|
||||
} catch (err: any) {
|
||||
this._step = undefined;
|
||||
this._params = undefined;
|
||||
this.closeDialog();
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.error"
|
||||
),
|
||||
text: this.hass.localize(
|
||||
text: `${this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.could_not_load"
|
||||
),
|
||||
)}: ${err.message || err.body}`,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -177,6 +176,7 @@ class DataEntryFlowDialog extends LitElement {
|
||||
});
|
||||
}
|
||||
|
||||
this._loading = undefined;
|
||||
this._step = undefined;
|
||||
this._params = undefined;
|
||||
this._devices = undefined;
|
||||
@ -372,15 +372,14 @@ class DataEntryFlowDialog extends LitElement {
|
||||
try {
|
||||
step = await this._params!.flowConfig.createFlow(this.hass, handler);
|
||||
} catch (err: any) {
|
||||
this._step = undefined;
|
||||
this._params = undefined;
|
||||
this.closeDialog();
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.error"
|
||||
),
|
||||
text: this.hass.localize(
|
||||
text: `${this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.could_not_load"
|
||||
),
|
||||
)}: ${err.message || err.body}`,
|
||||
});
|
||||
return;
|
||||
} finally {
|
||||
@ -405,6 +404,15 @@ class DataEntryFlowDialog extends LitElement {
|
||||
this._loading = "loading_step";
|
||||
try {
|
||||
this._step = await step;
|
||||
} catch (err: any) {
|
||||
this.closeDialog();
|
||||
showAlertDialog(this, {
|
||||
title: this.hass.localize(
|
||||
"ui.panel.config.integrations.config_flow.error"
|
||||
),
|
||||
text: err.message || err.body,
|
||||
});
|
||||
return;
|
||||
} finally {
|
||||
this._loading = undefined;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user