diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index a4b74d4429a3..49840d0e5a03 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -199,7 +199,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: SmartThingsConfigEntry) entry.data[CONF_LOCATION_ID], entry.data[CONF_TOKEN][CONF_INSTALLED_APP_ID], ) - except SmartThingsSinkError as err: + except (SmartThingsConnectionError, SmartThingsSinkError) as err: _LOGGER.exception("Couldn't create a new subscription") raise ConfigEntryNotReady from err subscription_id = subscription.subscription_id diff --git a/tests/components/smartthings/test_init.py b/tests/components/smartthings/test_init.py index 3daf68fbf97a..cee6ca7a3b12 100644 --- a/tests/components/smartthings/test_init.py +++ b/tests/components/smartthings/test_init.py @@ -188,16 +188,24 @@ async def test_create_subscription( @pytest.mark.parametrize("device_fixture", ["da_ac_rac_000001"]) -async def test_create_subscription_sink_error( +@pytest.mark.parametrize( + "error", + [ + SmartThingsSinkError("Sink error"), + SmartThingsConnectionError("Timeout occurred while connecting to SmartThings"), + ], +) +async def test_create_subscription_error( hass: HomeAssistant, devices: AsyncMock, mock_config_entry: MockConfigEntry, snapshot: SnapshotAssertion, + error: Exception, ) -> None: """Test handling an error when creating a subscription.""" assert CONF_SUBSCRIPTION_ID not in mock_config_entry.data - devices.create_subscription.side_effect = SmartThingsSinkError("Sink error") + devices.create_subscription.side_effect = error await setup_integration(hass, mock_config_entry)