Log Received Data on Deserialization Errors by Bibo-Joshi · Pull Request #4304 · python-telegram-bot/python-telegram-bot · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion telegram/_bot.py
3 changes: 2 additions & 1 deletion telegram/ext/_utils/webhookhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ async def post(self) -> None:
except Exception as exc:
_LOGGER.critical(
"Something went wrong processing the data received from Telegram. "
"Received data was *not* processed!",
"Received data was *not* processed! Received data was: %r",
data,
exc_info=exc,
)
raise tornado.web.HTTPError(
Expand Down
1 change: 1 addition & 0 deletions tests/ext/test_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,7 @@ def de_json_fails(*args, **kwargs):

assert len(caplog.records) == 1
assert caplog.records[-1].getMessage().startswith("Something went wrong processing")
assert "Received data was: {" in caplog.records[-1].getMessage()
assert caplog.records[-1].name == "telegram.ext.Updater"
assert response.status_code == 400
assert response.text == self.response_text.format(
Expand Down
23 changes: 23 additions & 0 deletions tests/test_bot.py