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 part4 #2568

Closed
2 tasks done
hui-an-yang opened this issue Jul 12, 2023 · 0 comments · Fixed by #2579 or #2536
Closed
2 tasks done

Error improvements per packages part4 #2568

hui-an-yang opened this issue Jul 12, 2023 · 0 comments · Fixed by #2579 or #2536
Labels
ga_release Work to be done so we can remove the beta dsignation
Milestone

Comments

@hui-an-yang
Copy link
Collaborator

hui-an-yang commented Jul 12, 2023

Error improvement of packages below

  • taquito-michel-codec
  • taquito-sapling

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: #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:

When querying a big map with Taquito, if the key is not passed properly, an Error is thrown saying Error: Unable to encode big map key; We need to provide more information on why Taquito is unable to encode it.
https://github.com/ecadlabs/taquito/pull/1960/files#diff-fafad56e5e81807b06d4001d7aacd4843ddd7d4205e66908c4b43029d67cb0d4R130

@hui-an-yang hui-an-yang added the ga_release Work to be done so we can remove the beta dsignation label Jul 12, 2023
@hui-an-yang hui-an-yang added this to the v17.1 milestone Jul 12, 2023
@Innkst Innkst modified the milestones: v17.1, v17.2 Jul 13, 2023
This was linked to pull requests Jul 20, 2023
@Innkst Innkst reopened this Jul 26, 2023
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
2 participants