Exception: GraphQL::InvalidNullError
- Inherits:
-
RuntimeTypeError
- Object
- StandardError
- Error
- RuntimeTypeError
- GraphQL::InvalidNullError
- Defined in:
- lib/graphql/invalid_null_error.rb
Overview
Raised automatically when a field's resolve function returns nil
for a non-null field.
Class Attribute Summary collapse
-
.parent_class ⇒ Object
Returns the value of attribute parent_class.
Instance Attribute Summary collapse
-
#field ⇒ GraphQL::Field
readonly
The field which failed to return a value.
-
#parent_type ⇒ GraphQL::BaseType
readonly
The owner of #field.
-
#value ⇒ nil, GraphQL::ExecutionError
readonly
The invalid value for this field.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(parent_type, field, value) ⇒ InvalidNullError
constructor
A new instance of InvalidNullError.
-
#parent_error? ⇒ Boolean
deprecated
Deprecated.
always false
-
#to_h ⇒ Hash
An entry for the response's "errors" key.
Constructor Details
#initialize(parent_type, field, value) ⇒ InvalidNullError
Returns a new instance of InvalidNullError.
15 16 17 18 19 20 |
# File 'lib/graphql/invalid_null_error.rb', line 15 def initialize(parent_type, field, value) @parent_type = parent_type @field = field @value = value super("Cannot return null for non-nullable field #{@parent_type.graphql_name}.#{@field.graphql_name}") end |
Class Attribute Details
.parent_class ⇒ Object
Returns the value of attribute parent_class.
33 34 35 |
# File 'lib/graphql/invalid_null_error.rb', line 33 def parent_class @parent_class end |
Instance Attribute Details
#field ⇒ GraphQL::Field (readonly)
Returns The field which failed to return a value.
10 11 12 |
# File 'lib/graphql/invalid_null_error.rb', line 10 def field @field end |
#parent_type ⇒ GraphQL::BaseType (readonly)
Returns The owner of #field.
7 8 9 |
# File 'lib/graphql/invalid_null_error.rb', line 7 def parent_type @parent_type end |
#value ⇒ nil, GraphQL::ExecutionError (readonly)
Returns The invalid value for this field.
13 14 15 |
# File 'lib/graphql/invalid_null_error.rb', line 13 def value @value end |
Class Method Details
.inspect ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/graphql/invalid_null_error.rb', line 41 def inspect if (name.nil? || parent_class&.name.nil?) && parent_class.respond_to?(:mutation) && (mutation = parent_class.mutation) "#{mutation.inspect}::#{parent_class.graphql_name}::InvalidNullError" else super end end |
.subclass_for(parent_class) ⇒ Object
35 36 37 38 39 |
# File 'lib/graphql/invalid_null_error.rb', line 35 def subclass_for(parent_class) subclass = Class.new(self) subclass.parent_class = parent_class subclass end |
Instance Method Details
#parent_error? ⇒ Boolean
Deprecated.
always false
28 29 30 |
# File 'lib/graphql/invalid_null_error.rb', line 28 def parent_error? false end |
#to_h ⇒ Hash
Returns An entry for the response's "errors" key.
23 24 25 |
# File 'lib/graphql/invalid_null_error.rb', line 23 def to_h { "message" => } end |