Skip to content

Commit 7d715d7

Browse files
author
Charlie Somerville
committed
set exception message for InvalidNullError
1 parent 32b75fe commit 7d715d7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/graphql/invalid_null_error.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ class InvalidNullError < GraphQL::Error
55
def initialize(field_name, value)
66
@field_name = field_name
77
@value = value
8+
super("Cannot return null for non-nullable field #{@field_name}")
89
end
910

1011
# @return [Hash] An entry for the response's "errors" key
1112
def to_h
12-
{
13-
"message" => "Cannot return null for non-nullable field #{@field_name}"
14-
}
13+
{ "message" => message }
1514
end
1615

1716
# @return [Boolean] Whether the null in question was caused by another error

0 commit comments

Comments
 (0)