lib/graphql/schema/scalar.rb in graphql-2.0.0 vs lib/graphql/schema/scalar.rb in graphql-2.0.1

- old
+ new

@@ -39,11 +39,10 @@ def default_scalar? @default_scalar ||= false end def validate_non_null_input(value, ctx) - result = Query::InputValidationResult.new coerced_result = begin ctx.query.with_error_handling do coerce_input(value, ctx) end rescue GraphQL::CoercionError => err @@ -54,14 +53,15 @@ str_value = if value == Float::INFINITY "" else " #{GraphQL::Language.serialize(value)}" end - result.add_problem("Could not coerce value#{str_value} to #{graphql_name}") + Query::InputValidationResult.from_problem("Could not coerce value#{str_value} to #{graphql_name}") elsif coerced_result.is_a?(GraphQL::CoercionError) - result.add_problem(coerced_result.message, message: coerced_result.message, extensions: coerced_result.extensions) + Query::InputValidationResult.from_problem(coerced_result.message, message: coerced_result.message, extensions: coerced_result.extensions) + else + nil end - result end end end end end