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

Uncaught (in promise) Error in browser console #404

Closed
techbos opened this issue Jan 8, 2017 · 3 comments
Closed

Uncaught (in promise) Error in browser console #404

techbos opened this issue Jan 8, 2017 · 3 comments
Assignees
Labels

Comments

@techbos
Copy link

techbos 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

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

@tmeasday
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.

@techbos
Copy link
Author

techbos 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 added a commit that referenced this issue Jan 10, 2017
@tmeasday
Copy link
Contributor

Fixed by #408

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

2 participants