mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-08-07 01:48:53 +00:00
fix(telegram): log network errors as warnings without stacktrace
This commit is contained in:
parent
e464a81545
commit
5968b408dc
@ -916,6 +916,11 @@ class TelegramChannel(BaseChannel):
|
|||||||
|
|
||||||
async def _on_error(self, update: object, context: ContextTypes.DEFAULT_TYPE) -> None:
|
async def _on_error(self, update: object, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
"""Log polling / handler errors instead of silently swallowing them."""
|
"""Log polling / handler errors instead of silently swallowing them."""
|
||||||
|
from telegram.error import NetworkError, TimedOut
|
||||||
|
|
||||||
|
if isinstance(context.error, (NetworkError, TimedOut)):
|
||||||
|
logger.warning("Telegram network issue: {}", str(context.error))
|
||||||
|
else:
|
||||||
logger.error("Telegram error: {}", context.error)
|
logger.error("Telegram error: {}", context.error)
|
||||||
|
|
||||||
def _get_extension(
|
def _get_extension(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user