Skip to content

Commit 15c23c0

Browse files
committed
Only build the default error message if the literal was invalid
1 parent 24af9a6 commit 15c23c0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/graphql/static_validation/rules/variable_default_values_are_correctly_typed.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ def validate_default_value(node, context)
2727
error_message = err.message
2828
end
2929

30-
error_message ||= "Default value for $#{node.name} doesn't match type #{type}"
31-
3230
if !valid
31+
error_message ||= "Default value for $#{node.name} doesn't match type #{type}"
3332
context.errors << message(error_message, node, context: context)
3433
end
3534
end

0 commit comments

Comments
 (0)