lib/graphql/schema/member/instrumentation.rb in graphql-1.10.0.pre1 vs lib/graphql/schema/member/instrumentation.rb in graphql-1.10.0.pre2
- old
+ new
@@ -76,18 +76,23 @@
@list_depth = list_depth
end
def call(obj, args, ctx)
result = @inner_resolve.call(obj, args, ctx)
- if ctx.skip == result || ctx.schema.lazy?(result) || result.nil? || result.is_a?(GraphQL::ExecutionError) || ctx.wrapped_object
+ if ctx.skip == result || ctx.schema.lazy?(result) || result.nil? || execution_errors?(result) || ctx.wrapped_object
result
else
ctx.wrapped_object = true
proxy_to_depth(result, @list_depth, ctx)
end
end
private
+
+ def execution_errors?(result)
+ result.is_a?(GraphQL::ExecutionError) ||
+ (result.is_a?(Array) && result.any? && result.all? { |v| v.is_a?(GraphQL::ExecutionError) })
+ end
def proxy_to_depth(inner_obj, depth, ctx)
if depth > 0
inner_obj.map { |i| proxy_to_depth(i, depth - 1, ctx) }
else