diff --git a/lib/graphql/execution/interpreter.rb b/lib/graphql/execution/interpreter.rb index bbc778355d..21d1c0a4f4 100644 --- a/lib/graphql/execution/interpreter.rb +++ b/lib/graphql/execution/interpreter.rb @@ -80,7 +80,6 @@ def run_all(schema, query_options, context: {}, max_complexity: schema.max_compl end rescue GraphQL::ExecutionError => err query.context.errors << err - NO_OPERATION end end results[idx] = result diff --git a/spec/graphql/authorization_spec.rb b/spec/graphql/authorization_spec.rb index b49af2aa44..b06b9f745c 100644 --- a/spec/graphql/authorization_spec.rb +++ b/spec/graphql/authorization_spec.rb @@ -909,8 +909,11 @@ def auth_execute(*args, **kwargs) assert_equal "Query", res["data"]["__typename"] unauth_res = auth_execute(query, context: { query_unauthorized: true }) - assert_nil unauth_res["data"] - assert_equal [{"message"=>"Unauthorized Query: nil"}], unauth_res["errors"] + + assert_equal({ + "errors" => [{"message"=>"Unauthorized Query: nil"}], + "data" => nil, + }, unauth_res.to_h) end describe "when the object authorization raises an UnauthorizedFieldError" do diff --git a/spec/graphql/execution/instrumentation_spec.rb b/spec/graphql/execution/instrumentation_spec.rb index 1044d0da47..c940e9309c 100644 --- a/spec/graphql/execution/instrumentation_spec.rb +++ b/spec/graphql/execution/instrumentation_spec.rb @@ -128,8 +128,13 @@ def int(value:) it "rescues execution errors from execute_query" do context = {raise_execution_error: true} res = schema.execute(" { int(value: 2) } ", context: context) - assert_equal "Raised from trace execute_query", res["errors"].first["message"] - refute res.key?("data"), "The query doesn't run" + + assert_equal({ + "data" => nil, + "errors" => [ + { "message" => "Raised from trace execute_query" }, + ] + }, res.to_h) end it "can assign a query string there" do