From f2e4943a536915f376c95fcf0138f608cdd94786 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 27 Feb 2023 15:29:14 +0100 Subject: [PATCH] Catch CancelledError when setting up components (#88635) * Catch CancelledError when setting up components * Catch CancelledError when setting up components * Also catch SystemExit --- homeassistant/config_entries.py | 3 ++- homeassistant/setup.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index bbea3f1d5f8..94f2bab75ac 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -463,7 +463,8 @@ class ConfigEntry: await self._async_process_on_unload() return - except Exception: # pylint: disable=broad-except + # pylint: disable-next=broad-except + except (asyncio.CancelledError, SystemExit, Exception): _LOGGER.exception( "Error setting up entry %s for %s", self.title, integration.domain ) diff --git a/homeassistant/setup.py b/homeassistant/setup.py index 9740d338eff..2377f47d7e9 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -264,7 +264,8 @@ async def _async_setup_component( SLOW_SETUP_MAX_WAIT, ) return False - except Exception: # pylint: disable=broad-except + # pylint: disable-next=broad-except + except (asyncio.CancelledError, SystemExit, Exception): _LOGGER.exception("Error during setup of component %s", domain) async_notify_setup_error(hass, domain, integration.documentation) return False