Exception: GraphQL::InvalidNullError

Inherits:
Error
  • Object
show all
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

Constructor Details

#initialize(field_name, value) ⇒ InvalidNullError



5
6
7
8
# File 'lib/graphql/invalid_null_error.rb', line 5

def initialize(field_name, value)
  @field_name = field_name
  @value = value
end

Instance Method Details

#parent_error?Boolean



18
19
20
# File 'lib/graphql/invalid_null_error.rb', line 18

def parent_error?
  @value.is_a?(GraphQL::ExecutionError)
end

#to_hHash



11
12
13
14
15
# File 'lib/graphql/invalid_null_error.rb', line 11

def to_h
  {
    "message" => "Cannot return null for non-nullable field #{@field_name}"
  }
end