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

Uncaught (in promise) Error in browser console #404

Closed
larrxu opened this Issue Jan 8, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@larrxu
Copy link

larrxu commented Jan 8, 2017

Steps to Reproduce

  1. Start the Githunt-API and -React projects
  2. Load the first page, without login.
  3. Change Githunt-API's Query schema to currentUser: User! (making it a non-null field).
  4. Go to browser and click any link or wait for hot reload.
  5. Uncaught (in promise) Error is shown in console.

Buggy Behavior

The error is shown as a uncaught promise error. There doesn't seem a way to stop/catch it.

Expected Behavior

I should be able to handle the error using data.error in my React component, resulting a cleaner error handling. Site viewers should never see the red error message in browser console. Or, I should be able to pass in an option leading to the error not being thrown.

export default graphql(PROFILE_QUERY, {
  options: { forceFetch: true },
  props: ({ data: { loading, error, currentUser } }) => ({
    loading, error, currentUser,
  }),
})(Profile);

Version

  • apollo-client@0.6.0
  • react-apollo@0.8.1

If this is by design, could you advice how to get rid of the error message in console?

@tmeasday

This comment has been minimized.

Copy link
Contributor

tmeasday commented Jan 9, 2017

You can see the error in the error prop on data (note that in this case the currentUser is also requested by the FeedPage).

However:

a) there doesn't indeed seem to be a way to avoid the error going to the console.
b) this actually completely breaks SSR.

@tmeasday tmeasday self-assigned this Jan 9, 2017

@tmeasday tmeasday added the bug label Jan 9, 2017

tmeasday added a commit that referenced this issue Jan 10, 2017

tmeasday added a commit that referenced this issue Jan 10, 2017

tmeasday added a commit that referenced this issue Jan 10, 2017

@larrxu

This comment has been minimized.

Copy link
Author

larrxu commented Jan 10, 2017

Thank you for looking into this. For SSR I actually created an issue on Githunt earlier.
https://github.com/apollostack/GitHunt-React/issues/180

@tmeasday tmeasday closed this Jan 10, 2017

tmeasday added a commit that referenced this issue Jan 10, 2017

@tmeasday tmeasday removed the in progress label Jan 10, 2017

@tmeasday

This comment has been minimized.

Copy link
Contributor

tmeasday commented Jan 10, 2017

Fixed by #408

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