rmosolgo/graphql-ruby

Incorrect/incomplete error message

fhoeben opened this issue · 1 comments

          @rmosolgo thanks for the fix we indeed get an error message now instead of an exception.

Could you take a look whether it would be possible to change the error to take into account what is actually expected according to the schema (like we get when passing -1)? I now (2.3.16) get only a message and a location (no path). And the message is a bit more general than normally:

Expected a number, but it was malformed ("-")

I expected a path to be present and a message like

Argument 'arg' on Field 'hello' has an invalid value (-foo). Expected type 'MyEnum!'.

Originally posted by @fhoeben in #5088 (comment)

Hey, sorry I didn't write back to this sooner. Basically, I don't have a vision for dramatically improving this error message. As discussed in #5115 it's much harder than most error messages because the malformation halts lexical analysis, not parsing, so there's no AST and no path.

There are probably some dramatic changes to the lexer/parser that would make this possible, but I don't have plans to explore it further so I'm closing this issue. I'm happy to respond to questions in comments on this issue or to review a PR if you have any suggestions to make, code-wise!