diff options
Diffstat (limited to 'app/graphql/mutations/base_mutation.rb')
-rw-r--r-- | app/graphql/mutations/base_mutation.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/app/graphql/mutations/base_mutation.rb b/app/graphql/mutations/base_mutation.rb index d57a097a9e2..5f98b222099 100644 --- a/app/graphql/mutations/base_mutation.rb +++ b/app/graphql/mutations/base_mutation.rb @@ -39,14 +39,16 @@ module Mutations true end - def load_application_object(argument, lookup_as_type, id, context) - ::Gitlab::Graphql::Lazy.new { super }.catch(::GraphQL::UnauthorizedError) do |e| - Gitlab::ErrorTracking.track_exception(e) - # The default behaviour is to abort processing and return nil for the - # entire mutation field, but not set any top-level errors. We prefer to - # at least say that something went wrong. - raise_resource_not_available_error! - end + def load_application_object(argument, id, context) + ::Gitlab::Graphql::Lazy.new { super } + end + + def unauthorized_object(error) + # The default behavior is to abort processing and return nil for the + # entire mutation field, but not set any top-level errors. We prefer to + # at least say that something went wrong. + Gitlab::ErrorTracking.track_exception(error) + raise_resource_not_available_error! end def self.authorizes_object? |