-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Throwing an error in a next()
callback leads to an ApolloError
#971
Comments
After talking to @tmeasday and taking another look, here's what I think we should do: Step 1: Intercept errors thrown from |
@helfer I don't think you covered step 2 in the PR? |
@stubailo Yes that's right, I didn't cover step 2, because we'll need a major version bump to make that change. I think the PR took care of the issue here, and step 2 should be taken care of for 0.6 or possibly even a later version. |
I think there are a variety of issues around about this, the clearest being apollographql/react-apollo#347 (also apollographql/react-apollo#303, #884, and more)
If you throw an exception in a
next()
function in a query subscriber, it throws all the way to here (logging on the way). Note that an bug in a React render function will throw such an error.This leads to an
ApolloError
being dispatched.If the same error path runs in that error handling (which is very possible with RA), you get an infinite loop (see #884).
I think we should separate the error handling for GraphQL problems from dispatch problems, via maybe adding an extra promise or an explicit
try catch
around the dispatch.@helfer let me know if putting a repro together would help here.
The text was updated successfully, but these errors were encountered: