-
Notifications
You must be signed in to change notification settings - Fork 269
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
Add utility checking functions for determining if a type is known. #125
Comments
👍 for adding both |
So that would just be something like this? def is_valid_type(self, typ):
if coder_found_for_type:
return True
else:
return False
def validate_type(self, typ):
if coder_found_for_type:
return
else:
raise ValidationError(...) |
Yeah, those implementations seem on-par with what I was thinking. Worth evaluating whether those would suffice for the linked |
I was looking into implementing a |
Or, we could subclass |
You can do the subclass approach with the plan to break that link in the next major version bump. In general I'm a fan of custom exceptions for things that a user would want to catch and only using things like |
Just made PR #128 to fix this. |
#128 was merged, close this? Note, I tracked this down via the following comment: |
@fubuloubu Ahh, yeah. Thanks! |
Inspired by: ethereum/eth-account#57 (comment)
What was wrong?
The
is_encodable
function can raise an exception if the type is unknown. This is probably un-avoidable, but it does leave 3rd party libraries in an awkward position when they might be dealing with an unknown or invalid type string.How can it be fixed?
Not sure which of these is the right API but adding one or both of the following utilities.
True/False
(never raises exception)None
or raiseseth_utils.ValidationError
The text was updated successfully, but these errors were encountered: