{"action":"created","issue":{"url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/925","labels_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/925/labels{/name}","comments_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/925/comments","events_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/925/events","html_url":"https://github.com/Reactive-Extensions/RxJS/issues/925","id":107404247,"number":925,"title":"fromPromise error in onNext","user":{"login":"vekexasia","id":200523,"avatar_url":"https://avatars.githubusercontent.com/u/200523?v=3","gravatar_id":"","url":"https://api.github.com/users/vekexasia","html_url":"https://github.com/vekexasia","followers_url":"https://api.github.com/users/vekexasia/followers","following_url":"https://api.github.com/users/vekexasia/following{/other_user}","gists_url":"https://api.github.com/users/vekexasia/gists{/gist_id}","starred_url":"https://api.github.com/users/vekexasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vekexasia/subscriptions","organizations_url":"https://api.github.com/users/vekexasia/orgs","repos_url":"https://api.github.com/users/vekexasia/repos","events_url":"https://api.github.com/users/vekexasia/events{/privacy}","received_events_url":"https://api.github.com/users/vekexasia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-20T16:53:48Z","updated_at":"2015-09-20T23:03:12Z","closed_at":null,"body":"Hello there,\r\n\r\nI'm having inconsistent behavior when an error is triggered in the onNext callback and Rx.Observable.fromPromise is used such as:\r\n\r\n```javascript\r\n Rx.Observable.fromPromise(\r\n          new Promise((resolve, reject) => {\r\n          resolve('antani');\r\n          })\r\n      ).subscribe(\r\n          (r) => {console.log(r); throw new Error(\"erroooooor!\");},\r\n          (e) => {console.log(e); done();}\r\n      );\r\n```\r\n\r\nif i switch to\r\n\r\n```javascript\r\nRx.Observable.of(1)\r\n      .subscribe(\r\n          (r) => {console.log(r); throw new Error(\"erroooooor!\");},\r\n          (e) => {console.log(e); done();}\r\n      );\r\n```\r\n\r\nthe error is shown in console as uncaught exception while, when using fromPromise is not. \r\n\r\nThis is causing issues when using `assert` within my async mocha tests. The error is catched somewhere in rxjs code (my guess) and so the test goes time-out.\r\n"},"comment":{"url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/comments/141843596","html_url":"https://github.com/Reactive-Extensions/RxJS/issues/925#issuecomment-141843596","issue_url":"https://api.github.com/repos/Reactive-Extensions/RxJS/issues/925","id":141843596,"user":{"login":"paulpdaniels","id":2528918,"avatar_url":"https://avatars.githubusercontent.com/u/2528918?v=3","gravatar_id":"","url":"https://api.github.com/users/paulpdaniels","html_url":"https://github.com/paulpdaniels","followers_url":"https://api.github.com/users/paulpdaniels/followers","following_url":"https://api.github.com/users/paulpdaniels/following{/other_user}","gists_url":"https://api.github.com/users/paulpdaniels/gists{/gist_id}","starred_url":"https://api.github.com/users/paulpdaniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulpdaniels/subscriptions","organizations_url":"https://api.github.com/users/paulpdaniels/orgs","repos_url":"https://api.github.com/users/paulpdaniels/repos","events_url":"https://api.github.com/users/paulpdaniels/events{/privacy}","received_events_url":"https://api.github.com/users/paulpdaniels/received_events","type":"User","site_admin":false},"created_at":"2015-09-20T23:03:12Z","updated_at":"2015-09-20T23:03:12Z","body":"Problem is that I don't think that some `Promise` types support the `catch` syntax. [jQuery]() comes to mind. I think you are right though, the `.then(success, fail)` syntax is problematic since it won't catch errors thrown from `onNext`. At first glance I would think we need something more like:\r\n\r\n```javascript\r\n\r\nFromPromiseObservable.prototype.subscribeCore = function(o) {\r\n  this.p.then(function(data) {\r\n    var result = tryCatch(o.onNext).call(o, data);\r\n    if (e === errorObj) {\r\n      return o.onError(result.e);\r\n    }\r\n    o.onCompleted();\r\n  }, function (err) { o.onError(err); });\r\n}\r\n\r\n```"}}