-
Notifications
You must be signed in to change notification settings - Fork 537
How Can I Use customFormatErrorFn to Get What My Resolver Returned (When it Doesn't Match the Schema and Causes an Error) #590
Comments
Actually, it looks like this would be super simple to fix (but it does look like a change is needed, not just documentation). On line 371 of index.js (https://github.com/graphql/express-graphql/blob/34f4b210dece533d94f642e3fe2b892c02c0d556/src/index.js) we can see that
An extremely simple (one-line) fix could remedy this, by just adding
I'll happily submit a PR for this (along with a documentation update) if a maintainer says they'll accept it. |
…entation on expected error fields (graphql#590)
Actually, this was so simple I decided to just make the PR anyway. I'm happy to modify as needed, but since I can't imagine this would hurt anything, and would provide useful debugging information (plus slightly improved documentation), I hope we can get it accepted in some form. |
@machineghost Thanks for contributing. It looks like a PR was never opened to merge this change. Could you rebase your branch and open a PR? |
…entation on expected error fields (graphql#590)
@danielrearden Fixed, sorry about that (#612) |
I'm not sure if this is a documentation bug or a feature request. What I'm looking for is simple: when I have (say) a field
foo: Foo
whereFoo
has a required sub-field ... and I return an object from my resolver forfoo
which doesn't have that field ... I want to see the object that my resolver returned (the one with the null field).However, from the documented fields there doesn't appear to be any way to access the value that was returned from the resolver.
P.S. I should note that the
completeValueCatchingError
ingraphql
itself does have aresult
property with this information, but it somehow seems to get dropped in this library (or again, maybe just isn't documented).The text was updated successfully, but these errors were encountered: