diff --git a/homeassistant/components/elkm1/discovery.py b/homeassistant/components/elkm1/discovery.py index 50db2840753..83b2d3f113b 100644 --- a/homeassistant/components/elkm1/discovery.py +++ b/homeassistant/components/elkm1/discovery.py @@ -63,6 +63,8 @@ async def async_discover_devices( if isinstance(discovered, Exception): _LOGGER.debug("Scanning %s failed with error: %s", targets[idx], discovered) continue + if isinstance(discovered, BaseException): + raise discovered from None for device in discovered: assert isinstance(device, ElkSystem) combined_discoveries[device.ip_address] = device diff --git a/homeassistant/components/notion/__init__.py b/homeassistant/components/notion/__init__.py index 88605fdbdfd..b8881fdf56d 100644 --- a/homeassistant/components/notion/__init__.py +++ b/homeassistant/components/notion/__init__.py @@ -189,6 +189,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: raise UpdateFailed( f"There was an unknown error while updating {attr}: {result}" ) from result + if isinstance(result, BaseException): + raise result from None data.update_data_from_response(result) diff --git a/homeassistant/components/wiz/discovery.py b/homeassistant/components/wiz/discovery.py index 0f4be1d873e..350ddfe278a 100644 --- a/homeassistant/components/wiz/discovery.py +++ b/homeassistant/components/wiz/discovery.py @@ -33,6 +33,8 @@ async def async_discover_devices( if isinstance(discovered, Exception): _LOGGER.debug("Scanning %s failed with error: %s", targets[idx], discovered) continue + if isinstance(discovered, BaseException): + raise discovered from None for device in discovered: assert isinstance(device, DiscoveredBulb) combined_discoveries[device.ip_address] = device diff --git a/homeassistant/helpers/service.py b/homeassistant/helpers/service.py index 4cb8852414b..3c6bf4436eb 100644 --- a/homeassistant/helpers/service.py +++ b/homeassistant/helpers/service.py @@ -885,7 +885,7 @@ async def entity_service_call( # Use asyncio.gather here to ensure the returned results # are in the same order as the entities list - results: list[ServiceResponse] = await asyncio.gather( + results: list[ServiceResponse | BaseException] = await asyncio.gather( *[ entity.async_request_call( _handle_entity_call(hass, entity, func, data, call.context) @@ -897,8 +897,8 @@ async def entity_service_call( response_data: EntityServiceResponse = {} for entity, result in zip(entities, results): - if isinstance(result, Exception): - raise result + if isinstance(result, BaseException): + raise result from None response_data[entity.entity_id] = result tasks: list[asyncio.Task[None]] = [] diff --git a/homeassistant/helpers/trigger.py b/homeassistant/helpers/trigger.py index 40e1860b409..c5cfdadabb2 100644 --- a/homeassistant/helpers/trigger.py +++ b/homeassistant/helpers/trigger.py @@ -305,7 +305,7 @@ async def async_initialize_triggers( variables: TemplateVarsType = None, ) -> CALLBACK_TYPE | None: """Initialize triggers.""" - triggers = [] + triggers: list[Coroutine[Any, Any, CALLBACK_TYPE]] = [] for idx, conf in enumerate(trigger_config): # Skip triggers that are not enabled if not conf.get(CONF_ENABLED, True): @@ -338,6 +338,8 @@ async def async_initialize_triggers( log_cb(logging.ERROR, f"Got error '{result}' when setting up triggers for") elif isinstance(result, Exception): log_cb(logging.ERROR, "Error setting up trigger", exc_info=result) + elif isinstance(result, BaseException): + raise result from None elif result is None: log_cb( logging.ERROR, "Unknown error while setting up trigger (empty result)"