#3241 Add web3 value error from Web3Exception for exceptions within the library #3299
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.
What was wrong?
The issue was identified in the RequestManager class of the Web3.py library, where error responses were not being handled as expected, leading to ambiguity in error handling. The exception
ValueError
is making it difficult for developers to understand the context and use case of the error they are currently getting.Related to Issue #3241
How was it fixed?
Added the
Web3ValueError
exception class to explicitly represent errors related to invalid values within the Web3.py context. This class enhances the granularity of error handling by distinctly addressing value-related issues.Integrated the
Web3ValueError
within theformatted_response
method of theRequestManager
. Now, whenformatted_response
encounters an error condition indicative of a value issue, it raisesWeb3ValueError
, thereby providing a more specific and meaningful error to the developer.Todo:
Cute Animal Picture