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.
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(torii): handle failed metadata fetch and empty metadata in db #2755
fix(torii): handle failed metadata fetch and empty metadata in db #2755
Changes from all commits
266c8cc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 245 in crates/torii/core/src/executor/erc.rs
Codecov / codecov/patch
crates/torii/core/src/executor/erc.rs#L245
Check warning on line 248 in crates/torii/core/src/executor/erc.rs
Codecov / codecov/patch
crates/torii/core/src/executor/erc.rs#L247-L248
Check warning on line 253 in crates/torii/core/src/executor/erc.rs
Codecov / codecov/patch
crates/torii/core/src/executor/erc.rs#L250-L253
Check warning on line 255 in crates/torii/core/src/executor/erc.rs
Codecov / codecov/patch
crates/torii/core/src/executor/erc.rs#L255
Check warning on line 109 in crates/torii/graphql/src/object/erc/token_balance.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/token_balance.rs#L106-L109
Check warning on line 240 in crates/torii/graphql/src/object/erc/token_balance.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/token_balance.rs#L240
Check warning on line 242 in crates/torii/graphql/src/object/erc/token_balance.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/token_balance.rs#L242
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.
Consider using proper error handling for JSON parsing.
Using
.expect()
could cause runtime panics if the metadata is not valid JSON. Even if metadata is present, it might not be well-formed JSON.Consider handling the JSON parsing error gracefully:
Check warning on line 125 in crates/torii/graphql/src/object/erc/token_transfer.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/token_transfer.rs#L122-L125
Check warning on line 269 in crates/torii/graphql/src/object/erc/token_transfer.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/token_transfer.rs#L269
Check warning on line 271 in crates/torii/graphql/src/object/erc/token_transfer.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/token_transfer.rs#L271
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.
🛠️ Refactor suggestion
Add tests for metadata handling.
The change to non-optional metadata field requires comprehensive testing to ensure robustness.
Consider adding tests for:
Would you like me to help create a test suite for these scenarios?