Skip to content

1994 taquito package error improvement #2559

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

Merged
merged 47 commits into from
Jul 11, 2023

Conversation

hui-an-yang
Copy link
Collaborator

@hui-an-yang hui-an-yang commented Jul 10, 2023

Thank you for your contribution to Taquito.

Before submitting this PR, please make sure:

  • Your code builds cleanly without any errors or warnings
  • You have run the linter against the changes
  • You have added unit tests (if relevant/appropriate)
  • You have added integration tests (if relevant/appropriate)
  • All public methods or types have TypeDoc coverage with a complete description, and ideally an @example
  • You have added or updated corresponding documentation
  • If relevant, you have written a first draft summary describing the change for inclusion in Release Notes.

In this PR, please also make sure:

  • You have linked this PR to the issue by putting closes #TICKETNUMBER in the description box (when applicable)
  • You have added a concise description on your changes

Release Note Draft Snippet

If relevant, please write a summary of your change that will be suitable for
inclusion in the Release Notes for the next Taquito release.

error improvement of package @taquito/taquito, @taquito/tzip12 and @taquito/tzip16

Breaking Changes:

  • In @taquito/taquito IntegerError is renamed to invalidBalanceError
  • In @taquito/taquito PreapreProvider used to throw RevealEstimateError now will throw PublicKeyNotFoundError
  • In @taquito/tzip-16 MetadataNotFound is renamed to ContractMetadataNotFoundError
  • In @taquito/tzip-16 InvalidMetadata is renamed to InvalidContractMetadataError
  • In @taquito/tzip-16 InvalidMetadataType is renamed to InvalidContractMetadataTypeError
  • In @taquito/tzip-16 BigMapMetadataNotFound is renamed to BigMapContractMetadataNotFoundError
  • In @taquito/tzip-16 UriNotFound is renamed to UriNotFoundError
  • In @taquito/tzip-16 InvalidUri is renamed to InvalidUriError
  • In @taquito/tzip-16 ProtocolNotSupported is renamed to ProtocolNotSupportedError
  • In @taquito/tzip-16 UnconfiguredMetadataProviderError is renamed to UnconfiguredContractMetadataProviderError
  • In @taquito/tzip-16 ForbiddenInstructionInViewCode is renamed to ForbiddenInstructionInViewCodeError

@netlify
Copy link

netlify bot commented Jul 10, 2023

Deploy Preview for taquito-test-dapp ready!

Name Link
🔨 Latest commit 82cb0ac
🔍 Latest deploy log https://app.netlify.com/sites/taquito-test-dapp/deploys/64ac80c9df98810008cb77f8
😎 Deploy Preview https://deploy-preview-2559--taquito-test-dapp.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

github-actions bot commented Jul 10, 2023

New packages have been deployed to the preview repository at https://npm.preview.tezostaquito.io/.

Published packages:

npm i @taquito/utils@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/core@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/rpc@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/beacon-wallet@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/tzip12@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/ledger-signer@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/http-utils@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/sapling@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/michelson-encoder@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/signer@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/tzip16@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/taquito@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/michel-codec@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/remote-signer@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/contracts-library@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/
npm i @taquito/local-forging@17.0.0-d464463-- --registry https://npm.preview.tezostaquito.io/

@github-actions
Copy link

github-actions bot commented Jul 10, 2023

A new deploy preview is available on Netlify at https://d464463--tezostaquito.netlify.app

@hui-an-yang hui-an-yang requested review from dsawali and ac10n July 10, 2023 17:30
@hui-an-yang hui-an-yang marked this pull request as ready for review July 10, 2023 17:31
super();
this.name = 'InvalidTokenMetadata';
this.message =
'Non-compliance with the TZIP-012 standard. The required property `decimals` is missing.';
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's useful to add the Token Metadata that has cause the failure. That helps the user diagnose their problem.

@@ -55,7 +55,7 @@ export class InvalidAddressError extends ParameterValidationError {
super();
this.name = 'InvalidAddressError';
this.message = `Invalid address "${address}"`;
errorDetail ? (this.message += ` ${errorDetail}.`) : null;
this.message += errorDetail ? ` ${errorDetail}.` : '.';
Copy link
Contributor

Choose a reason for hiding this comment

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

what does an example of an error message for this look like?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

something like this Invalid address "tz1iedjFYksExq8snZK9MNo4AvXHG" failed checksum.

@@ -147,14 +147,14 @@ describe('Metadata provider test', () => {
done();
});

it('Should fail with InvalidMetadata when metadata are not a JSON object', async (done) => {
it('Should fail with InvalidContractMetadata when metadata are not a JSON object', async (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be 'is not a JSON object'

super();
this.name = 'BigMapMetadataNotFound';
this.message =
'Non-compliance with the TZIP-016 standard. No big map named metadata was found in the contract storage.';
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, including the data can help with diagnostincs

* @category Error
* @description Error indicates missing big map metadata (non compliance to the TZIP-16 standard)
*/
export class BigMapMetadataNotFound extends TaquitoError {
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a bit of inconsistency in this file: Some classes end with Error while others don't

@@ -97,7 +97,7 @@ export const createOriginationOperation = async ({
};

if (isNaN(Number(balance))) {
throw new IntegerError(`Unexpected Invalid Integer ${balance}`);
throw new InvalidBalanceError(`Invalid Balance "${balance}", can't convert to a number`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new InvalidBalanceError(`Invalid Balance "${balance}", can't convert to a number`);
throw new InvalidBalanceError(`Invalid Balance "${balance}", cannot be converted to a number`);

@hui-an-yang hui-an-yang requested review from ac10n and dsawali July 10, 2023 22:07
@hui-an-yang hui-an-yang merged commit f67e9fb into master Jul 11, 2023
@hui-an-yang hui-an-yang deleted the 1994-taquito-package-error-improvement branch July 11, 2023 22:12
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.

3 participants