Graphql-ruby: Example of how to return a validation error from a mutation?

Created on 8 Dec 2016  Â·  4Comments  Â·  Source: rmosolgo/graphql-ruby

Sorry to use the "issues" like this but can you point me to documentation how to surface validation errors to the client on a mutation?

Most helpful comment

@Plummat, you want your mutation resolver to return:

GraphQL::ExecutionError.new("Some error")

All 4 comments

The options inside a mutation resolve function are the same as other resolve functions: http://rmosolgo.github.io/graphql-ruby/queries/error_handling

Please reopen and let me know if that doesn't help for your case!

Thanks!
So there is no way to just send a error response to the mutation query
which would trigger an onFail?

On Thu, Dec 8, 2016 at 7:49 PM, Robert Mosolgo notifications@github.com
wrote:

Closed #448 https://github.com/rmosolgo/graphql-ruby/issues/448.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/rmosolgo/graphql-ruby/issues/448#event-887730090, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFotvhwlIQqk6_axVCL3KW_2sNTpIcNsks5rGKWqgaJpZM4LIXjk
.

@Plummat, you want your mutation resolver to return:

GraphQL::ExecutionError.new("Some error")

Perfect. thanks Nick!

On Fri, Dec 9, 2016 at 10:44 AM, Nick Poorman notifications@github.com
wrote:

@Plummat https://github.com/Plummat, you want your mutation resolver to
return:

GraphQL::ExecutionError.new("Some error")

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rmosolgo/graphql-ruby/issues/448#issuecomment-266045078,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFotvoJm6oVTx0Uan-P7wcCbzJQRDWPMks5rGXdWgaJpZM4LIXjk
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KevinColemanInc picture KevinColemanInc  Â·  3Comments

jturkel picture jturkel  Â·  3Comments

skanev picture skanev  Â·  3Comments

amozoss picture amozoss  Â·  3Comments

jtippett picture jtippett  Â·  3Comments