mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 10:29:37 +00:00
Allow config flow to show error per field (#19522)
This commit is contained in:
@@ -201,8 +201,19 @@ class StepFlowForm extends LitElement {
|
||||
step,
|
||||
});
|
||||
} catch (err: any) {
|
||||
this._errorMsg =
|
||||
(err && err.body && err.body.message) || "Unknown error occurred";
|
||||
if (err && err.body) {
|
||||
if (err.body.message) {
|
||||
this._errorMsg = err.body.message;
|
||||
}
|
||||
if (err.body.errors) {
|
||||
this.step = { ...this.step, errors: err.body.errors };
|
||||
}
|
||||
if (!err.body.message && !err.body.errors) {
|
||||
this._errorMsg = "Unknown error occurred";
|
||||
}
|
||||
} else {
|
||||
this._errorMsg = "Unknown error occurred";
|
||||
}
|
||||
} finally {
|
||||
this._loading = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user