github-community-projects / github-community-projects/graphql-client
Errors not populating correctly
- Dominant language
- Ruby
- Stars
- 78
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
Given this response
```ruby
#::Mutation addUser=nil>,
@errors=#,
@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" => "foo@bar.com"}}]}>
```
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" => "foo@bar.com"},
"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
Contributor guide
Assessment
This issue has not been assessed yet.