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

Correct error handling from remote backend #1077

Conversation

MichalFikejs
Copy link

@MichalFikejs MichalFikejs commented Mar 19, 2019

This pull request is solving the issue that we encountered on our project.

Basically, the problem is that errors are not in the correct format, that means that you will get no sense error, which cannot help you.

Expected:
When my remote schema fails, I would love to get the error through my local schema.

Reality:
I will get just [object Object] as a message.

This pull request solves it.

In both cases in examples below, remote backend responded with the same result.

Result before:

{
  "errors": [
    {
      "message": "[object Object]",
      "locations": [
        {
          "line": 31,
          "column": 3
        }
      ],
      "path": [
        "pub_verifyMe"
      ]
    }
  ],
  "data": null
}

Result after:

{
  "errors": [
    {
      "message": "Invalid address.",
      "path": [
        "pub_verifyMe"
      ],
      "extensions": {
        "code": "BAD_USER_INPUT",
        "exception": {
          "invalidArgs": [
            "blockchainAddress"
          ],
          "stacktrace": [
            "UserInputError: Invalid address.",
            "    at /app/dist/graphql/verify/resolvers.js:76:40",
            "    at step (/app/dist/graphql/verify/resolvers.js:32:23)",
            "    at Object.throw (/app/dist/graphql/verify/resolvers.js:13:53)",
            "    at rejected (/app/dist/graphql/verify/resolvers.js:5:65)",
            "    at <anonymous>"
          ]
        }
      }
    }
  ],
  "data": null
}

@apollo-cla
Copy link

@MichalFikejs: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@avilaj
Copy link

avilaj commented Oct 15, 2019

any progress with this pr?

@MichalFikejs
Copy link
Author

@benjamn @hwillson Any comments on this?

@yaacovCR
Copy link
Collaborator

Not directed at me but I basically took same approach in the fork. See #1206

@yaacovCR
Copy link
Collaborator

yaacovCR commented Apr 1, 2020

Closed in favor of #1307

@yaacovCR yaacovCR closed this Apr 1, 2020
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.

4 participants