Raise new MethodUnavailable error for methods that are unavailable #2796
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?
When methods are not supported by the node, we were raising a generic ValueError. It would be good to raise a custom error and maybe add more details to the error message.
Closes #2448
How was it fixed?
Now if a method is unsupported, we raise
MethodUnavailable
, which inherits fromWeb3Exception
.@fselmo / @pacrob - This is one of the error messages that we get asked about most in the Discord channel. Does anyone have thoughts on adding a custom "hint" here or something? Maybe something along the lines of "The provider you're using does not support this method. Check the provider docs for more info."?
The response comes back like:
and we return
response["error"]
to the user. But maybe we should add something like:Open to other ideas too or just leaving it as-is!
Todo:
Cute Animal Picture