diff --git a/homeassistant/components/telegram_bot/__init__.py b/homeassistant/components/telegram_bot/__init__.py index fdf17023d39..d4e3e2afd07 100644 --- a/homeassistant/components/telegram_bot/__init__.py +++ b/homeassistant/components/telegram_bot/__init__.py @@ -8,7 +8,7 @@ from types import ModuleType from typing import Any from telegram import Bot -from telegram.error import InvalidToken +from telegram.error import InvalidToken, TelegramError import voluptuous as vol from homeassistant.config_entries import SOURCE_IMPORT @@ -26,7 +26,11 @@ from homeassistant.core import ( ServiceResponse, SupportsResponse, ) -from homeassistant.exceptions import ConfigEntryAuthFailed, ServiceValidationError +from homeassistant.exceptions import ( + ConfigEntryAuthFailed, + ConfigEntryNotReady, + ServiceValidationError, +) from homeassistant.helpers import config_validation as cv from homeassistant.helpers.typing import ConfigType @@ -418,6 +422,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: TelegramBotConfigEntry) await bot.get_me() except InvalidToken as err: raise ConfigEntryAuthFailed("Invalid API token for Telegram Bot.") from err + except TelegramError as err: + raise ConfigEntryNotReady from err p_type: str = entry.data[CONF_PLATFORM] diff --git a/homeassistant/components/telegram_bot/config_flow.py b/homeassistant/components/telegram_bot/config_flow.py index 5586b098757..63435a494f4 100644 --- a/homeassistant/components/telegram_bot/config_flow.py +++ b/homeassistant/components/telegram_bot/config_flow.py @@ -135,7 +135,7 @@ OPTIONS_SCHEMA: vol.Schema = vol.Schema( class OptionsFlowHandler(OptionsFlow): - """Options flow for webhooks.""" + """Options flow.""" async def async_step_init( self, user_input: dict[str, Any] | None = None