-
Notifications
You must be signed in to change notification settings - Fork 100
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
fix: export get_nftoken_id
and parse_nftoken_id
, better error handling
#646
Conversation
@@ -97,6 +97,9 @@ def has_nftoken_page(node: Node) -> bool: | |||
|
|||
affected_nodes = [node for node in meta["AffectedNodes"] if has_nftoken_page(node)] | |||
|
|||
if len(affected_nodes) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it typical to throw a exception and not just return None. This would be a normal occurance in cases where there is a tec code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be more difficult to identify a bug if it returns None
instead of erroring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Mayukha's approach of throwing an error because it indicates invalid user input; this justifies throwing an error. We should probably make it consistent with JS to throw an error too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, it's also valid to have a failed transaction and not throw an error. So now I'm leaning more towards not throwing an error and keeping things consistent 😄
High Level Overview of Change
This PR:
get_nftoken_id
andparse_nftoken_id
at thexrpl.utils
levelget_nftoken_id
if a metadata for an unrelated transaction is accidentally passed inContext of Change
Noticed while working on #417
Type of Change
Did you update CHANGELOG.md?
Test Plan
Added a test.