absinthe-graphql / absinthe-socket

Core JavaScript support for Absinthe WS-based operations
MIT License
150 stars 75 forks source link

createRequestError: parse object messages to string #46

Open ajoslin opened 4 years ago

ajoslin commented 4 years ago

Before, error objects would come out of absinthe sockets as Error: request [object Object].

For example, these sort of GraphQL errors returned via socket:

{
  errors: [
    {
      locations: [Array],
      message: 'Fragment spread has no type overlap with parent.\n' +
        'Parent possible types: ["RootSubscriptionType"]\n' +
        'Spread possible types: ["User"]\n'
    }
  ]
}

Now, they'll show up as stringified JSON.

Error: request: {
  "errors": [
    {
      "locations": [
        {
          "column": 0,
          "line": 2
        }
      ],
      "message": "Fragment spread has no type overlap with parent.\nParent possible types: [\"RootSubscriptionType\"]\nSpread possible types: [\"User\"]\n"
    }
  ]
}