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
This commit is contained in:
Alex Root Junior 2023-08-16 20:43:18 +03:00 committed by GitHub
parent 2093b45799
commit d0d0ff1be0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

1
CHANGES/1269.misc.rst Normal file
View file

@ -0,0 +1 @@
Enhanced the warning message in dispatcher to include a JSON dump of the update when update type is not known.

View file

@ -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