diff --git a/homeassistant/components/telegram_bot/polling.py b/homeassistant/components/telegram_bot/polling.py index 4c0de6ade1e..762ba08ab26 100644 --- a/homeassistant/components/telegram_bot/polling.py +++ b/homeassistant/components/telegram_bot/polling.py @@ -22,10 +22,11 @@ async def async_setup_platform(hass, bot, config): return True -def process_error(update: Update, context: CallbackContext): +def process_error(update: Update, context: CallbackContext) -> None: """Telegram bot error handler.""" try: - raise context.error + if context.error: + raise context.error except (TimedOut, NetworkError, RetryAfter): # Long polling timeout or connection problem. Nothing serious. pass diff --git a/mypy.ini b/mypy.ini index a883007de0d..57544f298ab 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2819,9 +2819,6 @@ ignore_errors = true [mypy-homeassistant.components.sonos.statistics] ignore_errors = true -[mypy-homeassistant.components.telegram_bot.polling] -ignore_errors = true - [mypy-homeassistant.components.template.number] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 4e11028d574..74a921c8351 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -74,7 +74,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.sonos.sensor", "homeassistant.components.sonos.speaker", "homeassistant.components.sonos.statistics", - "homeassistant.components.telegram_bot.polling", "homeassistant.components.template.number", "homeassistant.components.template.sensor", "homeassistant.components.toon",