Exception: DemoApi::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/demo_api/client.rb

Overview

Raised when the GraphQL API answers with errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ Error

Returns a new instance of Error.

Parameters:

  • errors (Array<Hash>) —

    the errors entries of the GraphQL response



14
15
16
17
# File 'lib/demo_api/client.rb', line 14

def initialize(errors)
  @errors = errors
  super(errors.map { |error| error['message'] }.join(', '))
end

Instance Attribute Details

#errors ⇒ Array<Hash> (readonly)

Returns the errors entries of the GraphQL response.

Returns:

  • (Array<Hash>) —

    the errors entries of the GraphQL response



11
12
13
# File 'lib/demo_api/client.rb', line 11

def errors
  @errors
end