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

Improve error messages

Open mathstuf opened this issue 5 years ago • 4 comments

I'm seeing error messages like operation type not in schema. Getting the operation type name in there would be handy :) .

mathstuf avatar Sep 07 '18 20:09 mathstuf

Good point, it shouldn't be too hard to do either. We should probably have a longer, more explanatory message that says:

  • operation type not in schema
  • what the operation we did not find is
  • what operations are there
  • what to do about it

I'll probably manage to find time to do this soon, if someone wants to contribute this it's even better :)

tomhoule avatar Sep 07 '18 20:09 tomhoule

I'll try and take a look at it this weekend, but I can't guarantee anything.

mathstuf avatar Sep 07 '18 21:09 mathstuf

Regarding this error:

            panic!(
                "operation type '{:?}' not in schema",
                operation.operation_type
            );

I can't manage to trigger that through the GitHub example - operation types are query, mutation, subscription or fragment right? The parser fails before that error is reachable. Maybe I'm misunderstanding something.

fnune avatar Mar 31 '19 12:03 fnune

IIRC, it is hit if you say query { someUnknownField }. It was a typo on my part, but the error message didn't help :) .

mathstuf avatar Apr 01 '19 14:04 mathstuf