Skip to content

Commit

Permalink
fix: catch error for getTokenStandardAndDetails (#26269)
Browse files Browse the repository at this point in the history
## **Description**

Related to this reported Sentry error:
https://metamask.sentry.io/issues/5660074561/?environment=production&project=273505&query=firstRelease%3A12.0.0&referrer=issue-stream&sort=freq&statsPeriod=90d&stream_index=22

Inside Import-nfts-modal.js we call `getTokenStandardAndDetails` without
catching the case where this call fails.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26269?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. To mock this behavior you can go to fct getTokenStandardAndDetails
and throw an error there
2. Import any NFT
3. The import NFT modal should not stay hanging after import

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/e75867ca-ecbc-451b-b18e-0f55d6f10dfe


### **After**

<!-- [screenshots/recordings] -->


https://github.com/user-attachments/assets/7c647d80-7470-45ae-a482-7a6cfb095a82


## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
sahar-fehri authored Aug 26, 2024
1 parent 28d784e commit d9e989e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const ImportNftsModal = ({ onClose }) => {
nftAddress,
null,
tokenId.toString(),
);
).catch(() => ({}));

trackEvent({
event: MetaMetricsEventName.TokenAdded,
Expand Down

0 comments on commit d9e989e

Please sign in to comment.