Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/graphql/execution/interpreter/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def continue_value(value, field, is_non_null, ast_node, result_name, selection_r
# When this comes from a list item, use the parent object:
parent_type = selection_result.is_a?(GraphQLResultArray) ? selection_result.graphql_parent.graphql_result_type : selection_result.graphql_result_type
# This block is called if `result_name` is not dead. (Maybe a previous invalid nil caused it be marked dead.)
err = parent_type::InvalidNullError.new(parent_type, field, value, ast_node)
err = parent_type::InvalidNullError.new(parent_type, field, ast_node)
schema.type_error(err, context)
end
else
Expand Down
6 changes: 1 addition & 5 deletions lib/graphql/invalid_null_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ class InvalidNullError < GraphQL::Error
# @return [GraphQL::Field] The field which failed to return a value
attr_reader :field

# @return [nil, GraphQL::ExecutionError] The invalid value for this field
attr_reader :value

# @return [GraphQL::Language::Nodes::Field] the field where the error occurred
attr_reader :ast_node

def initialize(parent_type, field, value, ast_node)
def initialize(parent_type, field, ast_node)
@parent_type = parent_type
@field = field
@value = value
@ast_node = ast_node
super("Cannot return null for non-nullable field #{@parent_type.graphql_name}.#{@field.graphql_name}")
end
Expand Down
1 change: 0 additions & 1 deletion spec/graphql/non_null_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def self.type_error(type_err, ctx)
assert_equal("Cannot return null for non-nullable field Cow.cantBeNullButIs", err.message)
assert_equal("Cow", err.parent_type.graphql_name)
assert_equal("cantBeNullButIs", err.field.name)
assert_nil(err.value)
end
end
end
Expand Down
Loading