Skip to content

Show beautiful GraphQL error messages #484

Closed
@bkeepers

Description

@bkeepers

GraphQL returns great error messages:

GraphQLError: [{"message":"Resource not accessible by integration","type":"FORBIDDEN","path":["resource","author","hovercard"],"locations":[{"line":11,"column":15}]}]

We should take advantage of that and make them B-E-A-utiful!

There was an error in your GraphQL Query:

on line 11, column 15:
              ... on User {
                hovercard {
                
                ^-- FORBIDDEN: Resource not accessible by integration

We need to get a full spec on what all the GraphQL errors will include, but here's some thoughts:

  • If locations is included, then show the original query with a pointer to exactly where the error occurred
  • Colorize the output so the error message is in red, and the context is in gray/white
  • If there are multiple errors, do this for all of them

cc @cjoudrey @tcbyrd

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