Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

GraphQL errors are not correctly passed to component props #378

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

GraphQL errors are not correctly passed to component props #378

davidye opened this issue Dec 21, 2016 · 4 comments
Labels

Comments

@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
Copy link
Contributor

@helfer should we be using isApolloError?

@helfer
Copy link
Contributor

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
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
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants