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

GraphQL errors are not correctly passed to component props #378

Closed
davidye opened this Issue Dec 21, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@davidye
Copy link
Contributor

davidye commented Dec 21, 2016

With apollo-client@0.5.23, it appears that:

(new ApolloError()) instanceof ApolloError // false

This is causing errors to be thrown from here:

https://github.com/apollostack/react-apollo/blob/02fe991c8645c939e5d41587c76c447c7081e02f/src/graphql.tsx#L381

Here's the relevant code which changed recently in apollo-client:

https://github.com/apollostack/apollo-client/blob/master/src/errors/ApolloError.ts#L3

Version

  • apollo-client@0.5.23
  • react-apollo@0.70.1
@tmeasday

This comment has been minimized.

Copy link
Contributor

tmeasday commented Dec 21, 2016

@helfer should we be using isApolloError?

@helfer

This comment has been minimized.

Copy link
Member

helfer commented Dec 21, 2016

@tmeasday as you probably saw in the code I ended up adding that function because I couldn't figure out why after updating TS new ApolloError() instanceof ApolloError === false. It's not exported though, so if it should be fixed quickly, I suggest just checking for the graphqlErrors property on the error, and then changing it to isApolloError later.

@davidye

This comment has been minimized.

Copy link
Contributor Author

davidye commented Dec 21, 2016

@helfer it's probably because extending built-in classes cannot be properly supported with transpilers, see:

http://stackoverflow.com/questions/33832646/extending-built-in-natives-in-es6-with-babel
babel/babel#1424

@tmeasday

This comment has been minimized.

Copy link
Contributor

tmeasday commented Dec 21, 2016

I think a quick fix is warranted here if someone wants to take a look.

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