mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-30 08:17: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
|
params.continueFlowId
|
||||||
);
|
);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._step = undefined;
|
this.closeDialog();
|
||||||
this._params = undefined;
|
|
||||||
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}`,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -177,6 +176,7 @@ class DataEntryFlowDialog extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._loading = undefined;
|
||||||
this._step = undefined;
|
this._step = undefined;
|
||||||
this._params = undefined;
|
this._params = undefined;
|
||||||
this._devices = undefined;
|
this._devices = undefined;
|
||||||
@ -372,15 +372,14 @@ class DataEntryFlowDialog extends LitElement {
|
|||||||
try {
|
try {
|
||||||
step = await this._params!.flowConfig.createFlow(this.hass, handler);
|
step = await this._params!.flowConfig.createFlow(this.hass, handler);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this._step = undefined;
|
this.closeDialog();
|
||||||
this._params = undefined;
|
|
||||||
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}`,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
@ -405,6 +404,15 @@ class DataEntryFlowDialog extends LitElement {
|
|||||||
this._loading = "loading_step";
|
this._loading = "loading_step";
|
||||||
try {
|
try {
|
||||||
this._step = await step;
|
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 {
|
} finally {
|
||||||
this._loading = undefined;
|
this._loading = undefined;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user