Skip to content

ApolloError adds object to error string making "GraphQL error: [object Object]" #4547

Closed
@kylepaulsen

Description

@kylepaulsen

Related code:

message += `GraphQL error: ${errorMessage}\n`;

Intended outcome:
It's not very useful to have [object Object] come back as an error string. Maybe check to see if you can JSON.stringify it first and return that string instead.

Actual outcome:
Errors that have objects as messages come back as "GraphQL error: [object Object]"

How to reproduce the issue:
Have a graphql server return an error message as an object. If this is not a good pattern, how else can we supply object shaped data as an error? Sure, we could stringify it, but then to do something with it, we would need to parse it after we remove that "GraphQL error:" part.

Versions
latest,
2.4.6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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