mirror of
https://github.com/home-assistant/core.git
synced 2026-08-03 20:24:55 +02:00
Fix swallowed exceptions in template action handlers (#171080)
This commit is contained in:
@@ -77,10 +77,12 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
await async_get_blueprints(hass).async_reset_cache()
|
||||
try:
|
||||
unprocessed_conf = await conf_util.async_hass_config_yaml(hass)
|
||||
# pylint: disable-next=home-assistant-action-swallowed-exception
|
||||
except HomeAssistantError as err:
|
||||
_LOGGER.error(err)
|
||||
return
|
||||
raise HomeAssistantError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="failed_to_reload_template_entities",
|
||||
translation_placeholders={"error": str(err)},
|
||||
) from err
|
||||
|
||||
integration = await async_get_integration(hass, DOMAIN)
|
||||
conf = await conf_util.async_process_component_and_handle_errors(
|
||||
|
||||
@@ -545,6 +545,9 @@
|
||||
"exceptions": {
|
||||
"code_format_template_error": {
|
||||
"message": "Error evaluating code format template \"{code_format_template}\" for {entity_id}: {cause}"
|
||||
},
|
||||
"failed_to_reload_template_entities": {
|
||||
"message": "Error reloading template entities: {error}"
|
||||
}
|
||||
},
|
||||
"issues": {
|
||||
|
||||
@@ -11,6 +11,7 @@ from homeassistant.components.template import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import SERVICE_RELOAD
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
@@ -147,7 +148,9 @@ async def test_reloadable_stops_on_invalid_config(hass: HomeAssistant) -> None:
|
||||
assert hass.states.get("sensor.state").state == "mytest"
|
||||
assert len(hass.states.async_all()) == 2
|
||||
|
||||
await async_yaml_patch_helper(hass, "configuration.yaml.corrupt")
|
||||
with pytest.raises(HomeAssistantError, match="Error reloading template entities: "):
|
||||
await async_yaml_patch_helper(hass, "configuration.yaml.corrupt")
|
||||
|
||||
assert hass.states.get("sensor.state").state == "mytest"
|
||||
assert len(hass.states.async_all()) == 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user