-
Notifications
You must be signed in to change notification settings - Fork 80
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
promise chain execution affected by whether an error handler is registered #274
Comments
The commit that explains this difference is 4eb0bce and it relates to issue #246. It seems that in the presence of an error handler thrown errors are caught but not re-thrown. It seems if the main purpose of registering an error handler through
} Although in the discussion of #246, catching the error in this way in Thoughts? |
To me it seems swallowing errors when a global error handler is registered is dangerous. For example, suppose we have methods
If the promise returned by If the methods were not part of the runloop:
Then if step1 rejects, and step1Fail throws an exception, then the Thus the behavior with a global error handler is different than you'd expect from either an ordinary promise chain or a promise chain involving the runloop but with no global error handler. |
Awesome digging @kbullaughey! Thank you for tracking this down so well. I do believe that #246 does do the correct thing ( |
Grr, accidentally submitted that comment before finishing (sorry). I totally agree that there is a bug here, I was just working out how to detangle things in Ember-land around emberjs/ember.js#14898 which I believe is generally related to the thing you are hitting here. |
I don't necessarily suggest accepting my pull request. I believe it may introduce an inconsistency between |
Thanks for the continued investigation here @kbullaughey. I have been digging at this and related problems most of the day. Should hopefully have some PR's up by EOW... |
I submitted #277 to address this, mind reviewing? |
It all looks good to me. And I can confirm that it solves the problems I was having. Though one question, this test has two assertions but |
Ya, mind fixing that up in a separate PR? Definitely seems confusing at least, most likely a copy paste error... |
I originally posted issue emberjs/ember.js#15864 to ember.js, but when I found I could explain the strange behavior purely based on the version of backburner used, perhaps the issue should be here.
The crux of it is that which callbacks are called in a promise chain is affected by whether I've called
Ember.onerror
or not. It seems that somehow backburner is behaving differently depending on if a callback has been registered, even if it's an empty callback.If you prefer me to migrate the issue here, I'm happy to. Here's a repo where I distill and illustrate the problem: https://github.com/kbullaughey/ember-effect-of-onerror
The text was updated successfully, but these errors were encountered: