fix: Just re-raise the original exception, as-is#5632
Open
roy-work wants to merge 1 commit intogetsentry:masterfrom
Open
fix: Just re-raise the original exception, as-is#5632roy-work wants to merge 1 commit intogetsentry:masterfrom
roy-work wants to merge 1 commit intogetsentry:masterfrom
Conversation
In Python `raise … from None` is an explicit request to raise the exception but to suppress any exception chaining. (See: https://docs.python.org/3/tutorial/errors.html#exception-chaining) This means that if, when an ASGI exception crashes, an exception causes another exception, that when the second exception (which has the first chained to it) reaches this point in the stack, these lines will re-raise it, but remove the chained exception. This can be confusing: ASGI frameworks will normally log a stack trace of the crashing application, but that stack trace will now be truncated, due to this `from None` removing the chained exception. The chained exception (which is the exception that kicked off the entire stack unwind) is usually the more interesting one, when you're debugging. Neither of the two changed lines seem to have a reason for `… from None`. Additionally, since they just re-raise the original exception, simply "`raise`" suffices. Fixes: getsentry#5624
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛
Documentation 📚
Internal Changes 🔧Openai Agents
Other
🤖 This preview updates automatically when you update the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In Python
raise … from Noneis an explicit request to raise the exception but to suppress any exception chaining. (See: https://docs.python.org/3/tutorial/errors.html#exception-chaining)This means that if, when an ASGI exception crashes, an exception causes another exception, that when the second exception (which has the first chained to it) reaches this point in the stack, these lines will re-raise it, but remove the chained exception. This can be confusing: ASGI frameworks will normally log a stack trace of the crashing application, but that stack trace will now be truncated, due to this
from Noneremoving the chained exception.The chained exception (which is the exception that kicked off the entire stack unwind) is usually the more interesting one, when you're debugging.
Neither of the two changed lines seem to have a reason for
… from None. Additionally, since they just re-raise the original exception, simply "raise" suffices.Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)