-
Notifications
You must be signed in to change notification settings - Fork 5k
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: Catch errors from the assets controller #29439
Merged
Merged
+35
−28
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [8490727]
Page Load Metrics (1850 ± 105 ms)
|
jpuri
previously approved these changes
Jan 7, 2025
matthewwalsh0
previously approved these changes
Jan 7, 2025
app/scripts/metamask-controller.js
Outdated
tokenId, | ||
); | ||
} catch (e) { | ||
log.error(`Failed to get token standard and details. Error: ${e}`); |
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 worth an error if this is common, could we also do a warn
as below?
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jan 8, 2025
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jan 8, 2025
pedronfigueiredo
dismissed stale reviews from matthewwalsh0 and jpuri
via
January 9, 2025 13:47
72425b3
jpuri
approved these changes
Jan 9, 2025
matthewwalsh0
approved these changes
Jan 9, 2025
Builds ready [72425b3]
Page Load Metrics (2134 ± 147 ms)
|
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jan 9, 2025
metamaskbot
added
the
release-12.11.0
Issue or pull request that will be included in release 12.11.0
label
Jan 9, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
release-12.11.0
Issue or pull request that will be included in release 12.11.0
team-confirmations
Push issues to confirmations team
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.
Description
This PR addresses a group of errors reported on Sentry that occur when
getTokenStandardAndDetails
inassetsContractController
returns "Unable to determine contract standard". Sentry Issue Link.The error happens fairly often because only contracts that strictly adhere to the standard ABIs for ERC20, ERC721, and ERC1155 are correctly parsed. When a contract does not conform to these standards, the function fails and throws an error.
This PR introduces error handling to catch and silence the error when assetsContractController.getTokenStandardAndDetails fails to determine the contract standard. The control flow of the function is adjusted to ensure it continues to execute normally even when the error is caught.
Changes
Added a try...catch block around the assetsContractController.getTokenStandardAndDetails call to catch and log the error.
Ensured that the function continues to execute and return appropriate details even when the error is caught.
Related issues
Fixes: #25212
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist