Errors not populating correctly

Open
#75 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
graphql, ruby
Domain
api, backend

Research direction

Start by tracing how the response's errors are normalized into GraphQL::Client::Errors, then inspect the AST check for errors mentioned in the report. Reproduce the response shown in the issue and verify that the returned GraphQL error populates the errors object rather than leaving its messages and details empty.

Written by the indexing model from the issue text.

Description

Given this response

#<GraphQL::Client::Response:0x000071fb2142c000
 @data=#<#<Module:0x000071fb20ea5820>::Mutation addUser=nil>,
 @errors=#<GraphQL::Client::Errors @messages={} @details={}>,
 @extensions=nil,
 @full_response=
  {"connection" => ["close"],
   "server" => ["TwistedWeb/24.3.0"],
   "date" => ["Wed, 18 Jun 2025 12:45:29 GMT"],
   "content-type" => ["application/json"],
   "content-length" => ["338"]},
 @original_hash=
  {"data" => {"addUser" => nil},
   "errors" =>
    [{"message" => "The provided field is not unique and already exists in GUS.",
      "locations" => [{"line" => 2, "column" => 3}],
      "path" => ["addUser"],
      "errorType" => "FieldExistsError",
      "data" => nil,
      "errorInfo" => {"errorType" => "FieldExistsError", "field" => "userPrincipalName", "value" => "[email protected]"}}]}>

The errors object is empty even though there is an error returned. I tried stepping through I was able to get the errors object after being normalized which yielded

{"message" => "The provided field is not unique and already exists in GUS.",
 "locations" => [{"line" => 2, "column" => 3}],
 "path" => ["addUser"],
 "errorType" => "FieldExistsError",
 "data" => nil,
 "errorInfo" => {"errorType" => "FieldExistsError", "field" => "userPrincipalName", "value" => "[email protected]"},
 "normalizedPath" => ["data", "addUser"]}

I'm assuming it's part of the AST check for errors but I don't really get how it works or what's missing

Dominant language
Ruby
Stars
79
Forks
227
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github-community-projects/graphql-client

All issues in github-community-projects/graphql-client

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.