refactor(sdk-python): hoist HTTPX network error names in exception converter#343
Closed
Gujiassh wants to merge 1 commit intoalibaba:mainfrom
Closed
refactor(sdk-python): hoist HTTPX network error names in exception converter#343Gujiassh wants to merge 1 commit intoalibaba:mainfrom
Gujiassh wants to merge 1 commit intoalibaba:mainfrom
Conversation
Contributor
Author
|
Maintainer note: this change stays intentionally behavior-preserving and scoped to a single refactor in the exception conversion path.\n\nIf useful, I can follow up with a separate PR that switches from string-name matching to direct exception-class checks and includes a small benchmark comparison. |
Collaborator
|
LGTM, efficient code refactoring! Please sign the CLA and @ninan-nn will review those changes. 😊 |
Contributor
Author
|
Thanks again — the CLA is signed now and the checks are all green on my side. @ninan-nn, when you have a moment, could you take a look? |
Collaborator
|
Duplicated with #376 |
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.
Summary
_is_httpx_network_errorinto a module-level constantWhy
_is_httpx_network_errorsits on the exception conversion path and can be called repeatedly under transient/network-failure conditions. Hoisting the constant removes repeated tuple construction and centralizes the canonical list of supported HTTPX network error names.Testing
python3 -m py_compile sdks/sandbox/python/src/opensandbox/adapters/converter/exception_converter.pypython3 -m pytest tests/test_converters_and_error_handling.py -qCompatibility