Improve invalid error messages in the config flows (#108075)
This commit is contained in:
parent
8ad0226241
commit
6fdad44941
10 changed files with 162 additions and 23 deletions
|
@ -110,10 +110,8 @@ class FlowManagerResourceView(_BaseFlowManagerView):
|
|||
result = await self._flow_mgr.async_configure(flow_id, data)
|
||||
except data_entry_flow.UnknownFlow:
|
||||
return self.json_message("Invalid flow specified", HTTPStatus.NOT_FOUND)
|
||||
except vol.Invalid as ex:
|
||||
return self.json_message(
|
||||
f"User input malformed: {ex}", HTTPStatus.BAD_REQUEST
|
||||
)
|
||||
except data_entry_flow.InvalidData as ex:
|
||||
return self.json({"errors": ex.schema_errors}, HTTPStatus.BAD_REQUEST)
|
||||
|
||||
result = self._prepare_result_json(result)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue