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

Provide appropriate error based on Taquito context when the RPC returns an exception #1996

Closed
roxaneletourneau opened this issue Oct 5, 2022 · 1 comment
Assignees
Labels
5 ga_release Work to be done so we can remove the beta dsignation
Milestone

Comments

@roxaneletourneau
Copy link
Collaborator

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

Task 5: Pay specific attention to the error returned by the RPC. Sometimes, the error is vague and not informative enough according to the context. We should provide a custom error with additional information in those cases.

TODO: use Taquito in different ways to generate failure from the RPC, inspect the error coming from the RPC, identify error messages that would benefit from clarification, and make the appropriate changes. Here are two examples that need to be addressed:

  • When trying to fetch a big map value using a key of the wrong type (for example, using X where a nat was expected), an error from the node bubble up and is hard to diagnose:
    Uncaught (in promise) HttpResponse: Http error response: (400) Failed to parse the request body: No case matched:
      Unhandled error (Invalid_argument "Z.of_substring_base: invalid digit")
      Missing object field string
      Missing object field bytes
      Unexpected object instead of array
      Missing object field prim
        at HttpBackend.<anonymous> (http://localhost:3030/node_modules/.vite/deps/chunk-V4G7R2DB.js?v=4243d8f3:1552:17)
        at Generator.throw (<anonymous>)
        at rejected (http://localhost:3030/node_modules/.vite/deps/chunk-V4G7R2DB.js?v=4243d8f3:1390:32)
  • An error comes from the RPC when estimating an operation using an account with a balance too low (Tezos.estimate.transfer got 400 #363). TODO: validate if the behavior is still the same; the issue was opened in 2020.
    HttpResponseError {
      message: 'Http error response: (400) Failed to parse the request body: No case matched:\n' +
        '  At /kind, unexpected string instead of endorsement\n' +
        '  At /kind, unexpected string instead of seed_nonce_revelation\n' +
        '  At /kind, unexpected string instead of double_endorsement_evidence\n' +
        '  At /kind, unexpected string instead of double_baking_evidence\n' +
        '  At /kind, unexpected string instead of activate_account\n' +
        '  At /kind, unexpected string instead of proposals\n' +
        '  At /kind, unexpected string instead of ballot\n' +
        '  At /kind, unexpected string instead of reveal\n' +
        '  At /destination:\n' +
        '    Unhandled error (Failure "Invalid contract notation.")\n' +
        '  At /kind, unexpected string instead of origination\n' +
        '  At /kind, unexpected string instead of delegation',
      status: 400,
      statusText: 'Bad Request',
      body: 'Failed to parse the request body: No case matched:\n' +
        '  At /kind, unexpected string instead of endorsement\n' +
        '  At /kind, unexpected string instead of seed_nonce_revelation\n' +
        '  At /kind, unexpected string instead of double_endorsement_evidence\n' +
        '  At /kind, unexpected string instead of double_baking_evidence\n' +
        '  At /kind, unexpected string instead of activate_account\n' +
        '  At /kind, unexpected string instead of proposals\n' +
        '  At /kind, unexpected string instead of ballot\n' +
        '  At /kind, unexpected string instead of reveal\n' +
        '  At /destination:\n' +
        '    Unhandled error (Failure "Invalid contract notation.")\n' +
        '  At /kind, unexpected string instead of origination\n' +
        '  At /kind, unexpected string instead of delegation',
      name: 'HttpResponse'
    }
@Innkst Innkst added this to the v15 milestone Oct 13, 2022
@dsawali
Copy link
Contributor

dsawali commented Nov 23, 2022

@roxaneletourneau roxaneletourneau modified the milestones: v15, v15.1 Dec 7, 2022
@Innkst Innkst added the ga_release Work to be done so we can remove the beta dsignation label Dec 7, 2022
@Innkst Innkst modified the milestones: v15.1, v16.1 Dec 29, 2022
@Innkst Innkst modified the milestones: v16.1, v16.2 Mar 11, 2023
@Innkst Innkst modified the milestones: v16.2, v17 May 17, 2023
@Innkst Innkst added the 5 label May 24, 2023
@dsawali dsawali self-assigned this May 31, 2023
This was referenced Jun 7, 2023
@Innkst Innkst closed this as completed Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 ga_release Work to be done so we can remove the beta dsignation
Projects
Status: Done
Development

No branches or pull requests

3 participants