Class: Gitlab::Graphql::Limit::FieldCallCount

Inherits:
GraphQL::Schema::FieldExtension
  • Object
show all
Defined in:
lib/gitlab/graphql/limit/field_call_count.rb

Instance Method Summary collapse

Instance Method Details

#resolve(object:, arguments:, context:) {|object, arguments| ... } ⇒ Object

Yields:

  • (object, arguments)

Raises:



7
8
9
10
11
12
# File 'lib/gitlab/graphql/limit/field_call_count.rb', line 7

def resolve(object:, arguments:, context:)
  raise Gitlab::Graphql::Errors::ArgumentError, 'Limit must be specified.' unless limit
  raise Gitlab::Graphql::Errors::LimitError, error_message if increment_call_count(context) > limit

  yield(object, arguments)
end