From d0d0ff1be0b52386786a2fec4a1d0cf0d68e92f4 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Wed, 16 Aug 2023 20:43:18 +0300 Subject: [PATCH] Update a warning message in dispatcher (#1269) * Update a warning message in dispatcher Enhanced the warning message in aiogram/dispatcher/dispatcher.py to include a JSON dump of the update. This change helps to give clearer and more detailed information on why an update type is unknown by including the specifics of what the update contains. * Added changelog --- CHANGES/1269.misc.rst | 1 + aiogram/dispatcher/dispatcher.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 CHANGES/1269.misc.rst diff --git a/CHANGES/1269.misc.rst b/CHANGES/1269.misc.rst new file mode 100644 index 00000000..c91b7ac3 --- /dev/null +++ b/CHANGES/1269.misc.rst @@ -0,0 +1 @@ +Enhanced the warning message in dispatcher to include a JSON dump of the update when update type is not known. diff --git a/aiogram/dispatcher/dispatcher.py b/aiogram/dispatcher/dispatcher.py index f85c91d4..827b300a 100644 --- a/aiogram/dispatcher/dispatcher.py +++ b/aiogram/dispatcher/dispatcher.py @@ -264,7 +264,8 @@ class Dispatcher(Router): warnings.warn( "Detected unknown update type.\n" "Seems like Telegram Bot API was updated and you have " - "installed not latest version of aiogram framework", + "installed not latest version of aiogram framework" + f"\nUpdate: {update.model_dump_json(exclude_unset=True)}", RuntimeWarning, ) raise SkipHandler() from e