8000 fix: Handle JSONDecodeError gracefully in StarletteRequestExtractor by moodix · Pull Request #4226 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

fix: Handle JSONDecodeError gracefully in StarletteRequestExtractor #4226

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

Merged

Conversation

moodix
Copy link
Contributor
@moodix moodix commented Apr 1, 2025

Previously, when encountering malformed JSON in request bodies, the json() method would raise a JSONDecodeError. This change updates the method to catch the exception and return None instead, providing more consistent behavior and preventing unexpected crashes.

Added a test case to verify this error handling behavior.

Previously, when encountering malformed JSON in request bodies, the json() method would
raise a JSONDecodeError. This change updates the method to catch the exception and
return None instead, providing more consistent behavior and preventing unexpected
crashes.

Added a test case to verify this error handling behavior.
@moodix moodix marked this pull request as ready for review April 1, 2025 16:52
@moodix moodix requested a review from a team as a code owner April 1, 2025 16:52
Copy link
Contributor
@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @moodix!

@moodix
Copy link
Contributor Author
moodix commented Apr 3, 2025

@sentrivana Looks like the workflow might need approval

@sentrivana sentrivana enabled auto-merge (squash) April 3, 2025 14:42
@sentrivana sentrivana merged commit 2b3b82d into getsentry:master Apr 3, 2025
138 checks passed
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
0