graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

typeError - cannot read property 'line' of undefined

Open li-boxuan opened this issue 6 years ago • 0 comments

I am using graphql-client to fetch data from GitHub.

Usually, errors returned from GitHub looks like this:

[{"message":"Could not resolve to an Organization with the login of 'GCI-AOSSIE'.","type":"NOT_FOUND","path":["organization"],"locations":[{"line":2,"column":3}]}]

However, sometimes GitHub returns errors as follows:

[{"message":"Something went wrong while executing your query. This may be the result of a timeout, or it could be a GitHub bug. Please include `E689:1AF6:67E816:BAAF4C:5BD321E1` when reporting this issue."}]

Note that it doesn't have locations field. Under the latter circumstance, https://github.com/nordsimon/graphql-client/blob/f8d1dcba8a65f290e35b71c883a18094594d6d5a/index.js#L2 together with https://github.com/nordsimon/graphql-client/blob/f8d1dcba8a65f290e35b71c883a18094594d6d5a/index.js#L11 would cause an error: cannot read property 'line' of undefined

c.f. https://github.com/coala/gci-leaders/pull/161#issuecomment-433302128

li-boxuan avatar Oct 26 '18 14:10 li-boxuan