Skip to content

Support for GraphQL errors #33723

Closed
Closed
@ueman

Description

@ueman

Problem Statement

I would like to be able to report GraphQL errors and see them nicely formatted.

According to the GraphQL docs, it returns structured error data. See this and this document.

Example time by using GitHubs GraphQL explorer:

The following query returns a result:

# Query
query { 
  viewer { 
    login
  }
}
// result
{
  "data": {
    "viewer": {
      "login": "ueman"
    }
  }
}

If I now introduce an error to the query

# Query
query { 
  viewer { 
    # note the removed `n` at the end
    logi
  }
}

I'm greeted with this error

{
  "errors": [
    {
      "path": [
        "query",
        "viewer",
        "logi"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "User",
        "fieldName": "logi"
      },
      "locations": [
        {
          "line": 8,
          "column": 5
        }
      ],
      "message": "Field 'logi' doesn't exist on type 'User'"
    }
  ]
}

Solution Brainstorm

If I report the query and the error response, I would like to be able to see the error highlighted in the query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions