I have recently been following RxJS and decided to knock up an example to find out how exceptions are handled differently in Promises versus Observables.
In the JS Bin below you will find the Promise swallows the exception thrown and we continue onto the Observable.
When subscribed to, the Observable throws an exception and the execution is halted. We never reach the last console log.
If you use the commented out catch statement for the Observable, then we can run to the last console log and exit cleanly.
So if you are going to use Promises, make sure you are vigilant and don't let those errors slip through and bite you later on. Perhaps look into libraries like Bluebird that provide methods like onPossiblyUnhandledRejection to help you out. Or get on the Observables train ;)
"running promise" "about to throw exception in promise" "NOTE: promise swallows exception and continues" "running observable" "about to throw exception in observable" X "Uncaught Error Observable (line 34)"
Removing the comments from the following lines:
"running promise" "about to throw exception in promise" "NOTE: promise swallows exception and continues" "running observable" "about to throw exception in observable" "Caught observable exception and returning it" "Error Observable" "last statement running"
I don't have a Pro account, but you can play with the JS Bin version.