diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index f46e0e674584..6680bf09c1aa 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -1280,12 +1280,10 @@ class ConfigEntry[_DataT = Any]: return False if result: hass.config_entries._async_schedule_save() # noqa: SLF001 - except ConfigEntryError, ConfigEntryNotReady: + except ConfigEntryNotReady: raise - except Exception: - self.logger.exception( - "Error migrating entry %s for %s", self.title, self.domain - ) + except Exception as exc: # noqa: BLE001 + self.__async_handle_config_entry_setup_error(hass, integration, exc, True) return False return result diff --git a/tests/test_config_entries.py b/tests/test_config_entries.py index f382f52e7b43..10a6f135e618 100644 --- a/tests/test_config_entries.py +++ b/tests/test_config_entries.py @@ -503,13 +503,13 @@ async def test_migrate_from_higher_version_not_supported( [ ( ConfigEntryError, - config_entries.ConfigEntryState.SETUP_ERROR, + config_entries.ConfigEntryState.MIGRATION_ERROR, "Error setting up entry Mock Title for comp during config entry migration", ), ( ConfigEntryAuthFailed, config_entries.ConfigEntryState.MIGRATION_ERROR, - "Error migrating entry Mock Title for comp", + "Config entry 'Mock Title' for comp integration could not authenticate", ), ( ConfigEntryNotReady,