Skip to content
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

Modify error handling for wallet_WatchAsset in NftController #1406

Merged
merged 3 commits into from
Jun 2, 2023

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented Jun 1, 2023

Modifies the error handling pattern for the wallet_watchAsset NFT support introduced in #1173. In that approach we were passing certain errors in the requestData to the ApprovalController so that the errors could be displayed in the UI. We have elected to not pursue this approach because it diverges from the pattern of throwing these errors directly to the dApp we use everywhere else.

@adonesky1 adonesky1 requested a review from a team as a code owner June 1, 2023 18:54
} catch {
errors.ownerFetchError = true;
} catch (error) {
throw rpcErrors.resourceUnavailable(`${error}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gudahtt @shanejonas I've put this unable to verify owner error as a resourceUnavailable code for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be error.message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adonesky1 adonesky1 force-pushed the watchNFT_revert-error-handling-pattern branch from 2662aab to 011613d Compare June 1, 2023 20:15
Comment on lines +1039 to +1041
throw rpcErrors.invalidInput(
'Suggested NFT is not owned by the selected account',
);
Copy link
Contributor Author

@adonesky1 adonesky1 Jun 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gudahtt @shanejonas I've put this error as a invalidInput code for now, since as Mark pointed out the dApp should not have sent a request for an asset the user does not own.

@adonesky1 adonesky1 force-pushed the watchNFT_revert-error-handling-pattern branch from 011613d to d663be0 Compare June 2, 2023 15:59
BelfordZ
BelfordZ previously approved these changes Jun 2, 2023
bergarces
bergarces previously approved these changes Jun 2, 2023
@adonesky1 adonesky1 dismissed stale reviews from bergarces and BelfordZ via dd0bb26 June 2, 2023 21:53
@adonesky1 adonesky1 merged commit e6326b7 into main Jun 2, 2023
@adonesky1 adonesky1 deleted the watchNFT_revert-error-handling-pattern branch June 2, 2023 22:07
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* Modify error handling for wallet_WatchAsset in NftController
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
* Modify error handling for wallet_WatchAsset in NftController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants