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.
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.
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 |
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 |
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 |