Skip to content

Commit 668995d

Browse files
authored
Fix incorrect exception in telegram_bot (home-assistant#162191)
1 parent 9eeae8e commit 668995d

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

homeassistant/components/telegram_bot/webhooks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from homeassistant.components.http import HomeAssistantRequest, HomeAssistantView
1515
from homeassistant.const import CONF_URL
1616
from homeassistant.core import HomeAssistant
17-
from homeassistant.exceptions import ConfigEntryNotReady
1817
from homeassistant.helpers.network import get_url
1918

2019
from .bot import BaseTelegramBot, TelegramBotConfigEntry
@@ -42,7 +41,7 @@ async def async_setup_bot_platform(
4241

4342
webhook_registered = await pushbot.register_webhook()
4443
if not webhook_registered:
45-
raise ConfigEntryNotReady("Failed to register webhook with Telegram")
44+
raise RuntimeError("Failed to register webhook with Telegram")
4645
_LOGGER.info(
4746
"[%s %s] Webhook registered with %s",
4847
bot.username,

tests/components/telegram_bot/test_webhooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def test_set_webhooks_failed(
4141
# first fail with exception, second fail with False
4242
assert mock_set_webhook.call_count == 2
4343

44-
# SETUP_ERROR is result of ConfigEntryNotReady("Failed to register webhook with Telegram") in webhooks.py
44+
# SETUP_ERROR is result of RuntimeError("Failed to register webhook with Telegram") in webhooks.py
4545
assert mock_webhooks_config_entry.state is ConfigEntryState.SETUP_ERROR
4646

4747
# test fail after retries

0 commit comments

Comments
 (0)