-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX beta] Avoid double throwing unhandled promise rejections.
When used in Ember, `RSVP` is configured to settle within Backburner's configured `actions` queue. Prior to this change, any unhandled promise rejections would: * `Ember.testing === true` * When `Ember.Test.adapter` was registered the `Test.adapter`'s `exception` method would be called, and the rejection would be logged to the console. * When `Ember.Test.adapter` was not registered, the `defaultDispatch` implementation would re-throw the error, and since RSVP settles in the run loop this means that the re-thrown error would be caught by the currently flushing Backburner queue's `invokeWithOnError` which sends any errors to `Ember.onerror` (if present). If `Ember.onerror` was not present, the exception would bubble up the "normal" unhandled exception system (and ultimately to `window.onerror`). * `Ember.testing === false` * When `Ember.onerror` is present, it would be invoked with the rejection reason. * When `Ember.onerror` is not present, the rejection reason would be logged to the console. After this change: * When `Ember.Test.adapter` is present, its `exception` method is invoked with the rejection. * Otherwise the rejection reason is rethrown. The benefits of this are: * It is now possible to debug rejected promises via "normal" JS exception debugging (e.g. break on uncaught exception). * There are many fewer decision points, making it much easier to grok what is going on.
- Loading branch information
Showing
5 changed files
with
9 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters