Skip to content
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

Rethrow caught errors in setTimeout #1367

Merged
merged 3 commits into from
Mar 6, 2017

Conversation

dallonf
Copy link

@dallonf dallonf commented Mar 6, 2017

This is an alternate approach to #1348 for fixing #1141. This approach is a bit more of a head-scratcher when you run into the code, but it doesn't break as many tests.

@@ -368,10 +368,12 @@ export class QueryManager {
try {
observer.error(apolloError);
} catch (e) {
console.error('Error in observer.error \n', e.stack);
// Throw error outside this control flow to avoid breaking Apollo's state
setTimeout(() => { throw e; }, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you put a comment 👍

Copy link
Contributor

@calebmer calebmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

@helfer
Copy link
Contributor

helfer commented Mar 6, 2017

Thanks a lot @dallonf !

@helfer helfer merged commit cd0f2e0 into apollographql:master Mar 6, 2017
@dallonf dallonf deleted the set-immediate-throw-error branch March 6, 2017 21:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants