Class: GraphqlRails::CustomExecutionError

Inherits:
ExecutionError
  • Object
show all
Defined in:
lib/graphql_rails/errors/custom_execution_error.rb

Overview

base class which is returned in case something bad happens. Contains all error rendering structure

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, extra_graphql_data = {}) ⇒ CustomExecutionError

Returns a new instance of CustomExecutionError.



13
14
15
16
# File 'lib/graphql_rails/errors/custom_execution_error.rb', line 13

def initialize(message, extra_graphql_data = {})
  super(message)
  @extra_graphql_data = extra_graphql_data.stringify_keys
end

Instance Attribute Details

#extra_graphql_dataObject (readonly)

Returns the value of attribute extra_graphql_data.



6
7
8
# File 'lib/graphql_rails/errors/custom_execution_error.rb', line 6

def extra_graphql_data
  @extra_graphql_data
end

Class Method Details

.accepts?(error) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/graphql_rails/errors/custom_execution_error.rb', line 8

def self.accepts?(error)
  error.is_a?(Hash) &&
    (error.key?(:message) || error.key?('message'))
end

Instance Method Details

#to_hObject



18
19
20
# File 'lib/graphql_rails/errors/custom_execution_error.rb', line 18

def to_h
  super
end