mirror of
https://github.com/home-assistant/core.git
synced 2026-10-06 06:15:47 -04:00
Stop catching DNSError in Radio Browser (#184083)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"""The Radio Browser integration."""
|
||||
|
||||
from aiodns.error import DNSError
|
||||
from radios import RadioBrowser, RadioBrowserError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -25,7 +24,7 @@ async def async_setup_entry(
|
||||
|
||||
try:
|
||||
await radios.stats()
|
||||
except (DNSError, RadioBrowserError) as err:
|
||||
except RadioBrowserError as err:
|
||||
raise ConfigEntryNotReady("Could not connect to Radio Browser API") from err
|
||||
|
||||
entry.runtime_data = radios
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import mimetypes
|
||||
from typing import override
|
||||
|
||||
from aiodns.error import DNSError
|
||||
import pycountry
|
||||
from radios import FilterBy, Order, RadioBrowser, RadioBrowserError, Station
|
||||
|
||||
@@ -74,7 +73,7 @@ class RadioMediaSource(MediaSource):
|
||||
radios = self.radios
|
||||
try:
|
||||
station = await radios.station(uuid=item.identifier)
|
||||
except (DNSError, RadioBrowserError) as e:
|
||||
except RadioBrowserError as e:
|
||||
raise Unresolvable(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="radio_browser_error",
|
||||
@@ -129,7 +128,7 @@ class RadioMediaSource(MediaSource):
|
||||
*await self._async_build_by_country(radios, item),
|
||||
],
|
||||
)
|
||||
except (DNSError, RadioBrowserError) as e:
|
||||
except RadioBrowserError as e:
|
||||
raise BrowseError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="radio_browser_error",
|
||||
@@ -162,7 +161,7 @@ class RadioMediaSource(MediaSource):
|
||||
),
|
||||
)
|
||||
)
|
||||
except (DNSError, RadioBrowserError) as e:
|
||||
except RadioBrowserError as e:
|
||||
raise BrowseError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="radio_browser_error",
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from aiodns.error import DNSError
|
||||
import pytest
|
||||
from radios import FilterBy, Order, RadioBrowserError
|
||||
from radios import FilterBy, Order, RadioBrowserConnectionError, RadioBrowserError
|
||||
|
||||
from homeassistant.components import media_source
|
||||
from homeassistant.components.media_player import BrowseError, SearchMediaQuery
|
||||
@@ -83,7 +82,7 @@ async def test_browsing_local(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exception",
|
||||
[DNSError, RadioBrowserError],
|
||||
[RadioBrowserConnectionError, RadioBrowserError],
|
||||
)
|
||||
async def test_browsing_exceptions(
|
||||
hass: HomeAssistant,
|
||||
@@ -161,7 +160,7 @@ async def test_search_media(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exception",
|
||||
[DNSError, RadioBrowserError],
|
||||
[RadioBrowserConnectionError, RadioBrowserError],
|
||||
)
|
||||
async def test_search_media_exceptions(
|
||||
hass: HomeAssistant,
|
||||
@@ -213,7 +212,7 @@ async def test_search_media_not_ready(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"exception",
|
||||
[DNSError, RadioBrowserError],
|
||||
[RadioBrowserConnectionError, RadioBrowserError],
|
||||
)
|
||||
async def test_resolve_media_exceptions(
|
||||
hass: HomeAssistant,
|
||||
|
||||
Reference in New Issue
Block a user