{"action":"created","issue":{"url":"https://api.github.com/repos/cujojs/most/issues/198","repository_url":"https://api.github.com/repos/cujojs/most","labels_url":"https://api.github.com/repos/cujojs/most/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/cujojs/most/issues/198/comments","events_url":"https://api.github.com/repos/cujojs/most/issues/198/events","html_url":"https://github.com/cujojs/most/issues/198","id":136164131,"number":198,"title":"Better unhandled error reporting","user":{"login":"rielsi","id":2265222,"avatar_url":"https://avatars.githubusercontent.com/u/2265222?v=3","gravatar_id":"","url":"https://api.github.com/users/rielsi","html_url":"https://github.com/rielsi","followers_url":"https://api.github.com/users/rielsi/followers","following_url":"https://api.github.com/users/rielsi/following{/other_user}","gists_url":"https://api.github.com/users/rielsi/gists{/gist_id}","starred_url":"https://api.github.com/users/rielsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rielsi/subscriptions","organizations_url":"https://api.github.com/users/rielsi/orgs","repos_url":"https://api.github.com/users/rielsi/repos","events_url":"https://api.github.com/users/rielsi/events{/privacy}","received_events_url":"https://api.github.com/users/rielsi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-24T19:34:39Z","updated_at":"2016-02-24T23:10:31Z","closed_at":null,"body":"In the current implementation of most.js, an error thrown in stream does not get reported, the actions down-stream are silently dropped (unless the stream is protected with `flatMapError` of course):\r\n```\r\nmost.of(42)\r\n  .tap(() => { throw new Error() })\r\n  .drain()\r\n  // No sign stream was interrupted!\r\n```\r\nDebugging _silently handled_ errors is a real pain. Yet, planting `flatMapError` before every consumer throughout a program adds a significant amount of noise, and is error-prone by itself. I would rather prefer an unhandled error to crash the program early. More sensible may be to propagate unhandled errors the way [Bluebird](https://github.com/petkaantonov/bluebird/) does it with [Global rejection events ](http://bluebirdjs.com/docs/api/error-management-configuration.html#global-rejection-events):\r\n```\r\nimport Promise from 'bluebird'\r\nPromise.resolve(42).then(() => { throw new Error() })\r\n// \"Unhandled rejection Error\" -- expected it, no surprises\r\n```"},"comment":{"url":"https://api.github.com/repos/cujojs/most/issues/comments/188504741","html_url":"https://github.com/cujojs/most/issues/198#issuecomment-188504741","issue_url":"https://api.github.com/repos/cujojs/most/issues/198","id":188504741,"user":{"login":"briancavalier","id":90518,"avatar_url":"https://avatars.githubusercontent.com/u/90518?v=3","gravatar_id":"","url":"https://api.github.com/users/briancavalier","html_url":"https://github.com/briancavalier","followers_url":"https://api.github.com/users/briancavalier/followers","following_url":"https://api.github.com/users/briancavalier/following{/other_user}","gists_url":"https://api.github.com/users/briancavalier/gists{/gist_id}","starred_url":"https://api.github.com/users/briancavalier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briancavalier/subscriptions","organizations_url":"https://api.github.com/users/briancavalier/orgs","repos_url":"https://api.github.com/users/briancavalier/repos","events_url":"https://api.github.com/users/briancavalier/events{/privacy}","received_events_url":"https://api.github.com/users/briancavalier/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T23:10:31Z","updated_at":"2016-02-24T23:10:31Z","body":"@rielsi As @TylorS says, most reports errors through the returned promise.  It uses the global `Promise` constructor, so you can shim that with your promise implementation of choice, including ones with good unhandled rejection reporting, such as `creed`, `when`, and `bluebird`.\r\n\r\nFor example:\r\n\r\n```js\r\nrequire('creed').shim();\r\nimport { just } from '../most';\r\n\r\njust(42).tap(oops).drain();\r\n\r\nfunction oops() { throw new Error(); }\r\n```\r\n\r\n```\r\nmost|master⚡ ⇒ ./node_modules/.bin/babel-node experiments/example\r\n/Users/brian/Projects/cujojs/most/node_modules/creed/dist/creed.js:506\r\n        throw e.value;\r\n        ^\r\n\r\nError\r\n    at oops (example.js:8:25)\r\n    at transform.js:43:3\r\n    at MapSink.event (Map.js:54:21)\r\n    at PropagateTask.emit (core.js:24:7)\r\n    at PropagateTask.run (PropagateTask.js:36:7)\r\n    at ScheduledTask.run (Scheduler.js:18:19)\r\n    at runTask (Scheduler.js:32:15)\r\n    at runTasks (Scheduler.js:159:4)\r\n    at Scheduler._findAndRunTasks (Scheduler.js:148:17)\r\n    at Scheduler._runReadyTasks (Scheduler.js:130:21)\r\n```\r\n"}}