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
Clarify error handling #47
Comments
What if, instead of raising an error from the loader, you raised it from the resolve function, for example: resolve ->(obj, args, context) {
promises = args["ids"].map { |id|
Resolvers::Profiles::ProfileRef.call(obj, {"id" => id}, context).then { |result|
if result.is_a?(GraphQL::ExecutionError)
raise(result)
else
result
end
}
}
Promise.all(promises)
} notice that using it that way would mean calling (I think that graphql-ruby will support that, if it doesn't it's a bug!) |
Unhandled exceptions in the Loader's We try to avoid doing external HTTP requests inline, so don't really have the same issue. We use graphql-batch to talk to internal datastores, where issues making requests to them are an internal error. If the exception on the promise itself isn't handled, then graphql-ruby will call
This isn't clear at all. How do the paths point to the promise? The graphql error information has graphql field names and the location information refers to the GraphQL query.
You issue description doesn't mention how the visitor is resolved, but this seems like a part you think is the bug. This definitely needs clarification. If you could demonstrate the bug with a simple example, then it would be much easier to tell you what is going on. |
@rmosolgo spot on. My problem primary results in not raising the @dylanahsmith No further action necessary. I solved it with @rmosolgo's help. Thank you both for your help! |
Given the following query
on the following type system
how would I reasonably indicate errors? My
Batch::Loader
is calling into a different system via HTTP/Rest, which can of course have timeouts.Currently I raise an
GraphQL::ExecutionError
from myperform(ids)
method when it runs into a timeout. That sort of works.The only nasty side effect of this is that in the response all paths are wrong (because they point to the resolved promise).
Which basically means that a client can't detect that resolving the visitor has failed.
How would you handle this? Any suggestions?
The text was updated successfully, but these errors were encountered: