Skip to content

[client] response errors sometimes not made available #577

@AlistairB

Description

@AlistairB

Hi,

When using the updateCheckRun mutation on github graphql api in one case I get the following response.

{
    "errors": [
      {
        "locations": [
          {
            "line": 3,
            "column": 7
          }
        ],
        "path": [
          "updateCheckRun"
        ],
        "message": "Could not resolve to a node with the global id of 'MDg6Q2hlY2tSdW4xNzk2OTI3MjMx'.",
        "type": "NOT_FOUND"
      }
    ],
    "data": {
      "updateCheckRun": null
    }
  }

The relevant graphql for this is:

type Mutation {
    updateCheckRun(input: UpdateCheckRunInput!): UpdateCheckRunPayload
}

As per this definition "updateCheckRun": null is a perfectly valid response and will json decode correctly. As such, morpheus assumes that everything is fine, however there are in fact errors. I believe the reason UpdateCheckRunPayload is nullable is because in the error case it won't be returned.

So I guess the assumption that a successful decode of the response = no errors is incorrect. ie. https://github.com/morpheusgraphql/morpheus-graphql/blob/master/morpheus-graphql-client/src/Data/Morpheus/Client/Fetch.hs#L63 perhaps this success case should also pattern match on an empty error list.

Or you might want 3 responses of, success, success with errors, parse failure.

I'd happy to attempt a PR if you know what the ideal solution is.

Metadata

Metadata

Assignees

Labels

📦 clientLabel for affected Package: "morpheus-graphql-client"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions