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