mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Don't abort on unknown error in nina config flow (#127908)
This commit is contained in:
parent
6df77ef94b
commit
1eb8d0fa1c
@ -116,7 +116,7 @@ class NinaConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
errors["base"] = "cannot_connect"
|
||||
except Exception as err: # noqa: BLE001
|
||||
_LOGGER.exception("Unexpected exception: %s", err)
|
||||
return self.async_abort(reason="unknown")
|
||||
errors["base"] = "unknown"
|
||||
|
||||
self.regions = split_regions(self._all_region_codes_sorted, self.regions)
|
||||
|
||||
@ -199,7 +199,7 @@ class OptionsFlowHandler(OptionsFlow):
|
||||
errors["base"] = "cannot_connect"
|
||||
except Exception as err: # noqa: BLE001
|
||||
_LOGGER.exception("Unexpected exception: %s", err)
|
||||
return self.async_abort(reason="unknown")
|
||||
errors["base"] = "unknown"
|
||||
|
||||
self.regions = split_regions(self._all_region_codes_sorted, self.regions)
|
||||
|
||||
|
@ -38,10 +38,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"abort": {
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"error": {
|
||||
"no_selection": "[%key:component::nina::config::error::no_selection%]",
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,9 @@ async def test_step_user_unexpected_exception(hass: HomeAssistant) -> None:
|
||||
DOMAIN, context={"source": SOURCE_USER}, data=deepcopy(DUMMY_DATA)
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
hass.config_entries.flow.async_abort(result["flow_id"])
|
||||
|
||||
|
||||
async def test_step_user(hass: HomeAssistant) -> None:
|
||||
@ -300,7 +302,9 @@ async def test_options_flow_unexpected_exception(hass: HomeAssistant) -> None:
|
||||
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "unknown"}
|
||||
hass.config_entries.options.async_abort(result["flow_id"])
|
||||
|
||||
|
||||
async def test_options_flow_entity_removal(
|
||||
|
Loading…
x
Reference in New Issue
Block a user