You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Error improvement of packages below
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:
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.Failed to encode value '[object Object]'
. Add tests to ensure proper rendering.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.Here is an example of an error that needs improvement:
The text was updated successfully, but these errors were encountered: