{"action":"opened","issue":{"url":"https://api.github.com/repos/rpominov/kefir/issues/124","labels_url":"https://api.github.com/repos/rpominov/kefir/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/rpominov/kefir/issues/124/comments","events_url":"https://api.github.com/repos/rpominov/kefir/issues/124/events","html_url":"https://github.com/rpominov/kefir/issues/124","id":94933132,"number":124,"title":"Confusing error if return forgotten","user":{"login":"cefn","id":159819,"avatar_url":"https://avatars.githubusercontent.com/u/159819?v=3","gravatar_id":"","url":"https://api.github.com/users/cefn","html_url":"https://github.com/cefn","followers_url":"https://api.github.com/users/cefn/followers","following_url":"https://api.github.com/users/cefn/following{/other_user}","gists_url":"https://api.github.com/users/cefn/gists{/gist_id}","starred_url":"https://api.github.com/users/cefn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cefn/subscriptions","organizations_url":"https://api.github.com/users/cefn/orgs","repos_url":"https://api.github.com/users/cefn/repos","events_url":"https://api.github.com/users/cefn/events{/privacy}","received_events_url":"https://api.github.com/users/cefn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-14T12:20:57Z","updated_at":"2015-07-14T12:20:57Z","closed_at":null,"body":"I'm using flatMap and I had a chunk of code like...\r\n\r\n```\r\n.flatMap( function(topic) {\r\n    Kefir.combine([Kefir.constant(topic), tree.getTopicValueStream(topic)]);\r\n});\r\n```\r\n\r\nWhich was causing this error to be thrown by Kefir (actual error line was unreported in Webstorm for some reason and had to be manually stepped through to trace it).\r\n\r\n    TypeError: Cannot read property '_alive' of undefined\r\n\r\nIt turned out that it was my error as there should have been a return keyword added to the flatMap callback...\r\n\r\n```\r\n.flatMap( function(topic) {\r\n    return Kefir.combine([Kefir.constant(topic), tree.getTopicValueStream(topic)]);\r\n});\r\n```\r\n\r\nIt would be nice if there were a way for an undefined return value to a flatMap function to throw a meaningful error by catching this exception and reporting that it's probably an undefined return value from a flatMap callback function.\r\n\r\nHere's a snapshot of the Kefir call stack leading to the exception thrown when the return value is undefined, and therefore this._active cannot be resolved...\r\n\r\n```\r\n if (this._concurLim === -1 || this._curSources.length < this._concurLim) {\r\n    this._addToCur(toObs(obj));\r\n} else {\r\n```\r\n\r\n```\r\n\t  _addToCur: function _addToCur(obs) {\r\n\t    if (this._active) {\r\n\r\n```"}}