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

feat(cardano-services): get metadata should return undefined on errors #466

Conversation

mirceahasegan
Copy link
Collaborator

@mirceahasegan mirceahasegan commented Sep 27, 2022

Context

DbSyncAssetProvider.getAsset returns nftMetadata: undefined when the asset is not an NFT.
Related to PR-412 fix: Gracefully handle CardanoTokenRegistry errors during getAsset request

Proposed Solution

It should return nftMetadata: null instead of undefined, similar to tokenMetadata.
It should catch getTokenMetadata errors and return undefined. Clients can then retry the fetch.

Todo:

  • Initial implementation
  • Validate try/catch approach (see code REVIEW comment)
  • Update unit tests

iccicci
iccicci previously approved these changes Sep 28, 2022
Copy link
Contributor

@iccicci iccicci left a comment

Choose a reason for hiding this comment

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

Apart from possible improvements from specific errors handling; this is good

Using `null` to signal non-existing metadata.

BREAKING CHANGE: metadatumToCip25 returns `null` instead of `undefined`
when metadata does not exist or couldn't be extracted
@mirceahasegan mirceahasegan force-pushed the feat/ADP-2215-gracefully-handle-getNftMetadata-errors-during-getAsset branch from ac75a5b to 4ddbb0c Compare September 28, 2022 08:13
@mirceahasegan mirceahasegan marked this pull request as ready for review September 28, 2022 08:14
@mirceahasegan mirceahasegan force-pushed the feat/ADP-2215-gracefully-handle-getNftMetadata-errors-during-getAsset branch from 4ddbb0c to 7b87d1d Compare September 28, 2022 09:48
Copy link
Contributor

@ivaylo-andonov ivaylo-andonov left a comment

Choose a reason for hiding this comment

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

GLTM

@rhyslbw rhyslbw merged commit be24ba8 into master Sep 28, 2022
@rhyslbw rhyslbw deleted the feat/ADP-2215-gracefully-handle-getNftMetadata-errors-during-getAsset branch September 28, 2022 12:29
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