-
Notifications
You must be signed in to change notification settings - Fork 526
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
fix(asgi): Fix KeyError if transaction does not exist #4095
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kevinji, thank you for the contribution!
Added a suggestion, please take a look.
Also, can you tell me when you observe this KeyError
? What's your setup like? Wondering what cases there are where there is no transaction
on the event and if that's not something we should fix.
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #4095 +/- ##
=======================================
Coverage 79.55% 79.55%
=======================================
Files 140 140
Lines 15521 15523 +2
Branches 2631 2631
=======================================
+ Hits 12347 12349 +2
Misses 2338 2338
Partials 836 836
|
We have a Starlette app which is running into this exception when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reworking, two more small suggestions and then we are good to merge
When "transaction" does not exist on the event, it will raise
KeyError: "transaction"
. Ensure that this code handles "transaction" and "transaction_info" gracefully.Thank you for contributing to
sentry-python
! Please add tests to validate your changes, and lint your code usingtox -e linters
.Running the test suite on your PR might require maintainer approval. The AWS Lambda tests additionally require a maintainer to add a special label, and they will fail until this label is added.