hasura / graphqurl

curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

throw elegant errors

wawhal opened this issue · comments

Errors should be of the format:

{
    "errors" : [
         ....
    ]
}

hey,
can you tell me what I need to do in this issue .? @wawhal

@kartikpandey2 a lot of custom errors are thrown and some might even show the stack trace. Every error should be of the form described above if graphqurl is being imported as a node library.

Also, proper error messages should be provided throughout the library. For example. if you run the command with a random URL, say

$ gq http://somerandom.url/graphql -q 'query { test { field } }'

It throws a large ugly error with a stack trace. That should never happen. Every error should be informative for the user.

@wawhal thanks, I am working on this issue.

@wawhal I have some doubts
The error should be displayed as error : ['some error'] or it should be of type array and should only be displayed as 'Some error' (informative error message and stack trace) and here error include CLI errors .?
I tried running following query
gq http://somerandom.url/graphql -q 'query { test { field } }'
It is throwing informative error ii.e,» Error: Unexpected arguments: {, test, {, field, }, }' » See more help with --help
So I am confused 😅 , How to solve this issue can you guide me.

Error: <informative-message> should be fine if it is a custom error. If the error comes from the server, it should be of the above type.

In case of gq http://somerandom.url/graphql -q 'query { test { field } }', it should throw Error: Invalid GraphQL endpoint or something like that.