Exception: Graphlient::Errors::ExecutionError

Inherits:
Error
  • Object
show all
Defined in:
lib/graphlient/errors/execution_error.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#inner_exception

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ExecutionError

Returns a new instance of ExecutionError.



6
7
8
9
# File 'lib/graphlient/errors/execution_error.rb', line 6

def initialize(response)
  super('the server responded with a GraphQL execution error')
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/graphlient/errors/execution_error.rb', line 4

def response
  @response
end

Instance Method Details

#errorsObject



11
12
13
# File 'lib/graphlient/errors/execution_error.rb', line 11

def errors
  response.data.errors
end

#to_sObject



15
16
17
18
19
20
# File 'lib/graphlient/errors/execution_error.rb', line 15

def to_s
  errors.details.map do |key, details|
    details = create_details(details).join("\n")
    [key, details].compact.join(': ')
  end.join("\n")
end