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

GQLError shouldn't require 'locations' #19

Closed
S7evinK opened this issue May 9, 2018 · 0 comments
Closed

GQLError shouldn't require 'locations' #19

S7evinK opened this issue May 9, 2018 · 0 comments

Comments

@S7evinK
Copy link

S7evinK commented May 9, 2018

I'm currently trying to run a mutation, which doesn't return locations, if there was an error.
Unfortunately, it seems like locations is required in case there was an error.

NoSuchMethodError: The method 'map' was called on null.
Receiver: null
Tried calling: map(Closure: (dynamic) => Location)
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
#1      new GQLError.fromJSON (package:graphql_client/src/exceptions.dart:39:33)
#2      new GQLException.<anonymous closure> (package:graphql_client/src/exceptions.dart:61:44)
#3      MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
#4      ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
#5      new List.from (dart:core/runtime/libarray_patch.dart:51:29)
#6      new GQLException (package:graphql_client/src/exceptions.dart:61:7)
#7      GQLClient._parseResponse (package:graphql_client/src/client.dart:109:17)
#8      GQLClient.execute (package:graphql_client/src/client.dart:65:20)

Query:

mutation($username: String!, $password: String!) {
  createToken (username: $username, password: $password) { 
  	token
  }
}

Response:

{
  "data": {
    "createToken": null
  },
  "errors": [
    {
      "message": "Username and password required.",
      "path": [
        "createToken"
      ]
    }
  ]
}

Successfull request work as expected.
I've tried to modify exceptions.dart, but without luck. (Just started with Dart a few days ago.)

@S7evinK S7evinK closed this as completed Nov 15, 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

No branches or pull requests

1 participant