Exception: 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 Method Summary collapse
-
#initialize(parent_type_name, field_name, value) ⇒ InvalidNullError
constructor
A new instance of InvalidNullError.
-
#parent_error? ⇒ Boolean
Whether the null in question was caused by another error.
-
#to_h ⇒ Hash
An entry for the response's "errors" key.
Constructor Details
#initialize(parent_type_name, field_name, value) ⇒ InvalidNullError
Returns a new instance of InvalidNullError.
5 6 7 8 9 10 |
# File 'lib/graphql/invalid_null_error.rb', line 5 def initialize(parent_type_name, field_name, value) @parent_type_name = parent_type_name @field_name = field_name @value = value super("Cannot return null for non-nullable field #{@parent_type_name}.#{@field_name}") end |
Instance Method Details
#parent_error? ⇒ Boolean
Returns Whether the null in question was caused by another error.
18 19 20 |
# File 'lib/graphql/invalid_null_error.rb', line 18 def parent_error? @value.is_a?(GraphQL::ExecutionError) end |
#to_h ⇒ Hash
Returns An entry for the response's "errors" key.
13 14 15 |
# File 'lib/graphql/invalid_null_error.rb', line 13 def to_h { "message" => } end |