Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kylepaulsen opened this issue Mar 6, 2019 · 2 comments

Comments

@kylepaulsen
Copy link

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

@OurMajesty
Copy link

There is PR, which scheduled for Apollo 3.0, if I'm right:
#3892

@hwillson
Copy link
Member

Please try a recent version of @apollo/client and let us know if this issue is still happening. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants