Exception: GraphQL::Client::ResponseErrors

Inherits:
Error
  • Object
show all
Includes:
Enumerable
Defined in:
lib/graphql/client/response.rb

Overview

Public: A collection of errors received from the server on execution.

Extends StandardError hierarchy so you may raise this instance.

Examples

raise response.errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition, errors) ⇒ ResponseErrors

Internal: Initialize ResponseErrors.



130
131
132
133
134
# File 'lib/graphql/client/response.rb', line 130

def initialize(definition, errors)
  @request_definition = definition
  @errors = errors.map { |error| ResponseError.new(definition, error) }
  super @errors.map(&:message).join(", ")
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



127
128
129
# File 'lib/graphql/client/response.rb', line 127

def errors
  @errors
end

Instance Method Details

#each(&block) ⇒ Object



136
137
138
# File 'lib/graphql/client/response.rb', line 136

def each(&block)
  errors.each(&block)
end