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

Error improvements per packages part1 #1994

Closed
3 tasks done
roxaneletourneau opened this issue Oct 5, 2022 · 2 comments · Fixed by #2475, #2486 or #2490
Closed
3 tasks done

Error improvements per packages part1 #1994

roxaneletourneau opened this issue Oct 5, 2022 · 2 comments · Fixed by #2475, #2486 or #2490
Assignees
Labels
ga_release Work to be done so we can remove the beta dsignation
Milestone

Comments

@roxaneletourneau
Copy link
Collaborator

roxaneletourneau commented Oct 5, 2022

Error improvement for priority packages

  • taquito-utils
  • taquito-local-forging
  • taquito-signer

Follow up of #160 as described in https://hackmd.io/@tca0T8LZT3au8LG6hSX20g/r1zTRTlfj_

Task 3 (should be split a least into one PR per package to ease the review): Go through all the errors in each package and:

  • Make the error extends one of these categories: Create high-level categories of errors #1992
  • Ensure that the error message is informative (what went wrong?) Use complete but simple sentences
  • When there is a problem with a value received as a parameter, the erroneous value should be part of the error message and an indication of what is wrong with it. For example: The key "inva2obfVMEuPUnadAConLWk7Tf4Dt3n4svSgJwrgpamRqJXvaYcg1" is invalid. It contains the invalid prefix "inva", but "p2sk" was expected. Surround the variable in the error message with quotes for clarity.
  • Make sure the variables are displayed properly in the error message to avoid error messages like: Failed to encode value '[object Object]'. Add tests to ensure proper rendering.
  • Ensure that the errors are actionable (tell the users what they can do to resolve the issue)
  • If an error overrides another error, make sure that it includes the "original error" as a param.
  • Document the error with a typedoc comment
  • Add an error code to each error with an additional explanation on a documentation page of the Taquito website. Add a link to the documentation in error.
  • Collect all error classes and put them inside a single-consistently named file in each package. E.g. an errors.ts file in the root of each package's /src folder. It will increase the ease of extending and maintaining error classes in the future.
  • When a method/function can throw an error, include the tag @throws in the typedoc comment with an explanation of when the error can be thrown.
  • Make sure there is a follow-up issues for the next set of packages:
    • based on effort involved, create an issue per package or cover multiple packages per issue

Here is an example of an error that needs improvement:

@Innkst Innkst added this to the v14.2 milestone Oct 13, 2022
@Innkst Innkst added the ga_release Work to be done so we can remove the beta dsignation label Oct 14, 2022
@dsawali
Copy link
Contributor

dsawali commented Dec 21, 2022

Hey team! Please add your planning poker estimate with Zenhub @hui-an-yang @roxaneletourneau @zainen

@Innkst Innkst changed the title Improve errors Improve errors: first 5 package Jan 4, 2023
@Innkst Innkst changed the title Improve errors: first 5 package Improve errors: first 5 packages Jan 4, 2023
@Innkst Innkst changed the title Improve errors: first 5 packages Improve errors: first set of packages Jan 11, 2023
@Innkst Innkst changed the title Improve errors: first set of packages Improve errors: set 1/3 of packages Jan 11, 2023
hui-an-yang added a commit that referenced this issue Jan 13, 2023
hui-an-yang added a commit that referenced this issue Jan 13, 2023
@Innkst Innkst modified the milestones: v15.1, v16 Jan 18, 2023
@Innkst Innkst changed the title Improve errors: set 1/3 of packages Improve errors: set 1 of packages Jan 18, 2023
@Innkst Innkst modified the milestones: v16, v16.2 Mar 11, 2023
@Innkst Innkst changed the title Improve errors: set 1 of packages Improve errors for all packages May 2, 2023
hui-an-yang added a commit that referenced this issue May 9, 2023
hui-an-yang added a commit that referenced this issue May 9, 2023
hui-an-yang added a commit that referenced this issue May 9, 2023
hui-an-yang added a commit that referenced this issue May 9, 2023
hui-an-yang added a commit that referenced this issue May 9, 2023
hui-an-yang added a commit that referenced this issue May 10, 2023
…rorDetail

BREAKING CHANGE: 1. In @taquito/rpc when validateContractAddress used to throw InvalidAddressError
will now throw InvalidContractAddressError. 2. In @taquito/sapling prepareUnshieldedTransaction
function when validateDestinationImplicitAddress used to throw InvalidAddressError now throw
InvalidKeyHashError

re #1994
@hui-an-yang hui-an-yang linked a pull request May 11, 2023 that will close this issue
9 tasks
hui-an-yang added a commit that referenced this issue May 12, 2023
* refactor: consolidate InvalidKeyError inot @taquito/core and improve across packages

BREAKING CHANGE: Class SaplingToolkit function prepareUnshieldedTransaction used to throw
InvalidKeyError now throw a InvalidAddressError instead

re #1994

* refactor: consolidate InvalidPublicKey into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidSignatureError into @taquito/core and improve across packages

re #1994

* refactor: minor update of the improved error classes

re #1994

* refactor: consolidate InvalidcontractAddressError into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidChainIdError into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidKeyHashError into @taquito/core and improve across packages

re #1994

* refactor: minor update for InvalidKeyHashError

re #1994

* refactor: consolidate InvalidOperationHashError into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidOperationKindError into @taquito/core and improve across packages

re #1994

* refactor: consolidate DeprecationError into @taquito/core

re #1994

* refactor: consolidate ProhibitedActionError into @taquito/core

re #1994

* refactor: imporve InvalidProtocolHashError and ValueConversionError in @taquito/utils

re #1994

* refactor: added unit tests for error classes in @taquito/core

re #1994

* refactor: consolidate ValidationResult into @taquito/core

re #1994

* refactor: improve InvalidAddressError to show validation result in errorDetail

BREAKING CHANGE: 1. In @taquito/rpc when validateContractAddress used to throw InvalidAddressError
will now throw InvalidContractAddressError. 2. In @taquito/sapling prepareUnshieldedTransaction
function when validateDestinationImplicitAddress used to throw InvalidAddressError now throw
InvalidKeyHashError

re #1994

* refactor: improve InvalidAddressError message format to be concise

re #1994

* refactor: improve InvalidBlockHashError message format to be concise

re #1994

* refactor: improve InvalidDerivationPathError message format to be consistent

re #1994

* refactor: improve InvalidHexStringError message format

re #1994

* refactor: improve InvalidMessageError message format

re #1994

* refactor: improve InvalidViewParameterError message format

re #1994

* refactor: improve InvalidKeyError message format

re #1994

* refactor: improve teh rest of common error classes message format

* refactor: replaced deprecated substr with substring across packages

* refactor: moved validationResult back to @taquito/core
@hui-an-yang hui-an-yang linked a pull request May 17, 2023 that will close this issue
9 tasks
@hui-an-yang hui-an-yang mentioned this issue May 20, 2023
9 tasks
hui-an-yang added a commit that referenced this issue May 23, 2023
* 1992 create high level error categories (#2452)

* build: created new package @taquito/core

re #1992

* feat: added high-level error categories with unit tests

re #1992

* build: new package-lock.json with @taquito-core for ci

* build: updated a file name and adjusted build order

* test: rename test file

* chore: bump @taquito/core version to 16.1.2

* 1993 consolidating duplicate errors (#2463)

* refactor: consolidated InvalidAddressError into @taquito/core

re #1993

* refactor: consolidated InvalidBlockHashError into @taquito/core

re #1993

* refactor: consolidated InvalidDerivationPathError into @taquito/core

re #1993

* refactor: added InvalidDerivationPathError unit test in @taquito/core

re #1993

* refactor: consolidated InvalidHexStringError in to @taquito/core and some style patches

re #1993

* refactor: consolidated InvalidMessageError into @taquito/core

re #1993

* refactor: consolidated InvalidViewParameterError into @taquito/core

re #1993

* refactor: improve InvalidViewParameterError in @taquito/core

re #1993

* refactor: removed tailling params destination/source in InvalidAddressError

* 1994 @taquito utils error improvement (#2475)

* refactor: consolidate InvalidKeyError inot @taquito/core and improve across packages

BREAKING CHANGE: Class SaplingToolkit function prepareUnshieldedTransaction used to throw
InvalidKeyError now throw a InvalidAddressError instead

re #1994

* refactor: consolidate InvalidPublicKey into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidSignatureError into @taquito/core and improve across packages

re #1994

* refactor: minor update of the improved error classes

re #1994

* refactor: consolidate InvalidcontractAddressError into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidChainIdError into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidKeyHashError into @taquito/core and improve across packages

re #1994

* refactor: minor update for InvalidKeyHashError

re #1994

* refactor: consolidate InvalidOperationHashError into @taquito/core and improve across packages

re #1994

* refactor: consolidate InvalidOperationKindError into @taquito/core and improve across packages

re #1994

* refactor: consolidate DeprecationError into @taquito/core

re #1994

* refactor: consolidate ProhibitedActionError into @taquito/core

re #1994

* refactor: imporve InvalidProtocolHashError and ValueConversionError in @taquito/utils

re #1994

* refactor: added unit tests for error classes in @taquito/core

re #1994

* refactor: consolidate ValidationResult into @taquito/core

re #1994

* refactor: improve InvalidAddressError to show validation result in errorDetail

BREAKING CHANGE: 1. In @taquito/rpc when validateContractAddress used to throw InvalidAddressError
will now throw InvalidContractAddressError. 2. In @taquito/sapling prepareUnshieldedTransaction
function when validateDestinationImplicitAddress used to throw InvalidAddressError now throw
InvalidKeyHashError

re #1994

* refactor: improve InvalidAddressError message format to be concise

re #1994

* refactor: improve InvalidBlockHashError message format to be concise

re #1994

* refactor: improve InvalidDerivationPathError message format to be consistent

re #1994

* refactor: improve InvalidHexStringError message format

re #1994

* refactor: improve InvalidMessageError message format

re #1994

* refactor: improve InvalidViewParameterError message format

re #1994

* refactor: improve InvalidKeyError message format

re #1994

* refactor: improve teh rest of common error classes message format

* refactor: replaced deprecated substr with substring across packages

* refactor: moved validationResult back to @taquito/core

* refactor: addressed pr comments of wording and naming

* 1994 taquito local forging error improvement (#2486)

* refactor: update file name of error.ts to errors.ts for consistency

* refactor: improve InvalidOperationSchemaError

* refactor: improve OversizedEntryPointError

* refactor: improve InvalidBallotValueError

* refactor: improve DecodeBallotValueError

* refactor: imrpove UnexpectedMichelsonValueError

* refactor: improve OperationDecodingError

* refactor: imporve OperationEncodingError

* refactor: imrpove UnsupportedOperationError

* refactor: improve DecodePvmKindError

* refactor: improve InvalidSmartRollupAddressError

* refactor: improve InvalidSmartRollupCommitmentHashError and DecodePvmKindError

BREAKING CHANGE: 1. In @taquito/local-forging smartRollupAddressDecoder used to throw InvalidAddressError now throw invalidContractAddressErro 2. In @taquito/local-forging used to have class InvalidSmartRollupContractAddressError now is InvalidSmartRollupCommitmentHashError 3. In @taquito/local-forging function smartRollupContractAddressEncoder rename to smartRollupCommitmentHashEncoder

* 1994 taquito signer error improvement (#2490)

* refactor: imrpove InvalidMnemonicError

* refactor: improve InvalidBitSize and InvalidCurveError

* refactor: imporve InvalidSeedLengthError

* refactor: replace PrivateKeyError with InvalidKeyError from @taquito/core and improve InvalidKeyErro

BREAKING CHANGE: PrivateKeyError is replaced by common error InvalidKeyError from @taquito/core

* refactor: imrpove ToBeImplemented

* docs: added typedoc of InvalidSeedLengthError and ToBeImplemented

* refactor: imporve InvalidPassphraseError

* chore: updated pack-lock.json

* fix: fix overlooked merge conflicts

* chore: updated package-lock.json and keep bip39 v3.0.4
@hui-an-yang hui-an-yang changed the title Error improvements per packages Error improvements per packages part1 May 24, 2023
@hui-an-yang hui-an-yang linked a pull request May 24, 2023 that will close this issue
9 tasks
@hui-an-yang
Copy link
Collaborator

created issue #2505 to continue the work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ga_release Work to be done so we can remove the beta dsignation
Projects
Status: Done
5 participants