mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 05:06:13 +01:00
Fix incorrect exception in telegram_bot (#162191)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user