Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the captured exception on invalid JSON #1454

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

sirosen
Copy link
Contributor

@sirosen sirosen commented Sep 10, 2024

I encountered this as an issue while handling the bottle 0.13 update from 0.12.
The behavior of JSON decoding failures has changed slightly vs 0.12, and while updating I was surprised to find that error.exception was unset, when a JSONDecodeError was caught.

Setting the inner exception to the caught exception helps callers catch and re-emit JSON decoding errors with their own code (e.g., to meet error API standards for their application).


Please let me know if this PR is missing anything it needs to progress.
I'm happy to take extra steps (add new tests, sign a CLA, etc) as appropriate.

@defnull
Copy link
Member

defnull commented Sep 10, 2024

Thanks, that makes a lot of sense. No CLA needed (Bottle is MIT Licensed). I'll check this tomorrow and merge :)

@defnull defnull merged commit 87b2bf1 into bottlepy:master Sep 11, 2024
@sirosen sirosen deleted the improve-invalid-json-handling branch September 11, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants