lib/graphql/execution/lazy.rb in graphql-1.8.4 vs lib/graphql/execution/lazy.rb in graphql-1.8.5
- old
+ new
@@ -38,16 +38,29 @@
v
rescue GraphQL::ExecutionError => err
err
end
end
- @value
+
+ if @value.is_a?(StandardError)
+ raise @value
+ else
+ @value
+ end
end
# @return [Lazy] A {Lazy} whose value depends on another {Lazy}, plus any transformations in `block`
def then
self.class.new {
yield(value)
+ }
+ end
+
+ # @param lazies [Array<Object>] Maybe-lazy objects
+ # @return [Lazy] A lazy which will sync all of `lazies`
+ def self.all(lazies)
+ self.new {
+ lazies.map { |l| l.is_a?(Lazy) ? l.value : l }
}
end
# This can be used for fields which _had no_ lazy results
# @api private