summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/lazy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/graphql/lazy.rb')
-rw-r--r--lib/gitlab/graphql/lazy.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/lazy.rb b/lib/gitlab/graphql/lazy.rb
index 54013cf4790..3563504226c 100644
--- a/lib/gitlab/graphql/lazy.rb
+++ b/lib/gitlab/graphql/lazy.rb
@@ -17,6 +17,14 @@ module Gitlab
self.class.new { yield force }
end
+ def catch(error_class = StandardError, &block)
+ self.class.new do
+ force
+ rescue error_class => e
+ yield e
+ end
+ end
+
# Force evaluation of a (possibly) lazy value
def self.force(value)
case value