diff --git a/homeassistant/components/telegram_bot/webhooks.py b/homeassistant/components/telegram_bot/webhooks.py index 980ecd19333..c31227d0a63 100644 --- a/homeassistant/components/telegram_bot/webhooks.py +++ b/homeassistant/components/telegram_bot/webhooks.py @@ -14,7 +14,6 @@ from telegram.ext import Application, ApplicationBuilder, TypeHandler from homeassistant.components.http import HomeAssistantRequest, HomeAssistantView from homeassistant.const import CONF_URL from homeassistant.core import HomeAssistant -from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.network import get_url from .bot import BaseTelegramBot, TelegramBotConfigEntry @@ -42,7 +41,7 @@ async def async_setup_bot_platform( webhook_registered = await pushbot.register_webhook() if not webhook_registered: - raise ConfigEntryNotReady("Failed to register webhook with Telegram") + raise RuntimeError("Failed to register webhook with Telegram") _LOGGER.info( "[%s %s] Webhook registered with %s", bot.username, diff --git a/tests/components/telegram_bot/test_webhooks.py b/tests/components/telegram_bot/test_webhooks.py index ef59df3fb8f..25ed17fd3a1 100644 --- a/tests/components/telegram_bot/test_webhooks.py +++ b/tests/components/telegram_bot/test_webhooks.py @@ -41,7 +41,7 @@ async def test_set_webhooks_failed( # first fail with exception, second fail with False assert mock_set_webhook.call_count == 2 - # SETUP_ERROR is result of ConfigEntryNotReady("Failed to register webhook with Telegram") in webhooks.py + # SETUP_ERROR is result of RuntimeError("Failed to register webhook with Telegram") in webhooks.py assert mock_webhooks_config_entry.state is ConfigEntryState.SETUP_ERROR # test fail after retries