{"action":"created","comment":{"url":"https://api.github.com/repos/cerebral/cerebral/pulls/comments/109281757","pull_request_review_id":30379152,"id":109281757,"diff_hunk":"@@ -110,7 +98,7 @@ export default connect({\n     renderAction (action, index) {\n       if (action._functionTreePrimitive) {\n         return (\n-          <div key={index}>\n+          <div key={index} onClick={(event) => event.stopPropagation()}>\n             <span className='signal-groupName'><strong>{action.type}</strong>{action.name ? ': ' + action.name : null}</span>","path":"debugger/src/components/Debugger/Signals/Signal/index.js","position":40,"original_position":40,"commit_id":"8dff2a28659dc9605838c08ba9cb5c44e3e358b0","original_commit_id":"9db61bda8f48f57a82477fa529ed5d6340ed3d57","user":{"login":"henri-hulski","id":7619824,"avatar_url":"https://avatars0.githubusercontent.com/u/7619824?v=3","gravatar_id":"","url":"https://api.github.com/users/henri-hulski","html_url":"https://github.com/henri-hulski","followers_url":"https://api.github.com/users/henri-hulski/followers","following_url":"https://api.github.com/users/henri-hulski/following{/other_user}","gists_url":"https://api.github.com/users/henri-hulski/gists{/gist_id}","starred_url":"https://api.github.com/users/henri-hulski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henri-hulski/subscriptions","organizations_url":"https://api.github.com/users/henri-hulski/orgs","repos_url":"https://api.github.com/users/henri-hulski/repos","events_url":"https://api.github.com/users/henri-hulski/events{/privacy}","received_events_url":"https://api.github.com/users/henri-hulski/received_events","type":"User","site_admin":false},"body":"@christianalfoni I think this is related:\r\nhttps://facebook.github.io/react/docs/conditional-rendering.html#inline-if-with-logical--operator","created_at":"2017-04-01T09:33:30Z","updated_at":"2017-04-01T09:33:31Z","html_url":"https://github.com/cerebral/cerebral/pull/793#discussion_r109281757","pull_request_url":"https://api.github.com/repos/cerebral/cerebral/pulls/793","_links":{"self":{"href":"https://api.github.com/repos/cerebral/cerebral/pulls/comments/109281757"},"html":{"href":"https://github.com/cerebral/cerebral/pull/793#discussion_r109281757"},"pull_request":{"href":"https://api.github.com/repos/cerebral/cerebral/pulls/793"}}},"pull_request":{"url":"https://api.github.com/repos/cerebral/cerebral/pulls/793","id":112342405,"html_url":"https://github.com/cerebral/cerebral/pull/793","diff_url":"https://github.com/cerebral/cerebral/pull/793.diff","patch_url":"https://github.com/cerebral/cerebral/pull/793.patch","issue_url":"https://api.github.com/repos/cerebral/cerebral/issues/793","number":793,"state":"open","locked":false,"title":"feat(Controller): adjust error throwing and catching","user":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars2.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"body":"OKAY! So after the PR of https://github.com/cerebral/cerebral/pull/775 a huge discussion started. It was a long, somewhat confusing and a little bit frustrating discussion, but it was an important one and really glad we had it! Thanks to everyone involved for patience and understanding :)\r\n\r\nThe previous PR created a new concept of stopping execution, this is not ideal. We should always try to adjust to existing solutions first and the existing solution to stop execution in JavaScript is to `throw`. So by forcing us to find a concept that fits our needs within the limitation of normal `throwing` I think we have come to a better, more familiar and even more powerful concept.\r\n\r\nThe spark behind this RFC was to be able to write more vertical code:\r\n\r\n```js\r\n// Instead of this\r\n[\r\n  getThis, {\r\n    success: saveThis,\r\n    error: showError\r\n  }\r\n]\r\n\r\n// You would write this\r\n[\r\n  getThis,\r\n  saveThis\r\n]\r\n```\r\n\r\nThe big question is... how do we stop execution when `getThis` has an \"error\"? With this PR you will just throw:\r\n\r\n```js\r\nfunction getThis ({http}) {\r\n  return http.get('/this')\r\n    .then((response) => ({data: response.result})\r\n    .catch((response) => throw new Error(response.error))\r\n}\r\n```\r\n\r\nThis error does not have to be a plain error though, you might rather want to extend your own error class like this:\r\n\r\n```js\r\nfunction getThis ({http}) {\r\n  return http.get('/this')\r\n    .then((response) => ({data: response.result})\r\n    .catch((response) => throw new HttpError(response))\r\n}\r\n```\r\n\r\nThe `http-provider` and `firebase-provider` does export its own error types you can specifically handle.\r\n\r\nIn low level function-tree, errors goes to a normal `catch`. So when you execute a tree:\r\n\r\n```js\r\nrunTree('some_name', [someFunc], {foo: 'bar'})\r\n  .catch((error) => {})\r\n```\r\n\r\nThis makes function-tree become a promise on functional steroids :)\r\n\r\nIn Cerebral we do not handle the tree at this low level, so we are free to make this more explicit by:\r\n\r\n*someModule.js*\r\n```js\r\n{\r\n  state: {},\r\n  signals: {\r\n    somethingHappened: [],\r\n    somethingThatCanErrorHappened: {\r\n      signal: [],\r\n      catch: new Map([\r\n        [Error, showError('wuuuut?')]\r\n      ])\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nNow you are able to define two parts to a signal. Its normal execution and what should happen on an error. With no catch, errors are thrown to the console.\r\n\r\nIt was decided to use a `Map` to define what errors you want to handle as that allows us to check the `instanceof` under the hood. Making you able to act on specific errors, but catch them all generally in some \"lower priority\" error handler.\r\n\r\nThe catch sequences will have an `error` property added to its payload. It contains the error serialized as `{name: 'Error', message: 'whatevah', stack: '...'}`, or whatever is is defined on the `toJSON` method of the error.\r\n\r\nSo by default all errors are thrown to console, it is only when you insert a catch for a signal that you will start handling them. No matter if you filter out error, the debugger will show you exactly what action caused the error, what the error was and optionally it will show the catch execution if defined. \r\n\r\n(it is called \"catch\" in this PR)\r\n![screen shot 2017-03-23 at 14 16 50](https://cloud.githubusercontent.com/assets/3956929/24270151/3dbe9b10-1014-11e7-9c9c-f69c7805f5a4.png)\r\n\r\nYou can still listen to errors globally like normal:\r\n\r\n```js\r\ncontroller.on('error', (error) => {})\r\n```\r\n\r\nThese events are triggered no matter if you catch or not, good to use for error tracking in production.\r\n\r\nEven though this has taken some time and seems like a massive change, it really is not. You can write your Cerebral application exactly as you do now. No breaking change here. It is only when you get into very complex signals and you want to \"verticalize\" them you now have the possibility to do so, and it is based on a core javascript concept of try/catch :-)\r\n\r\n## Summary\r\n\r\n- Function-tree execute functions now returns a promise if no regular callback is provided\r\n- Catched errors execution is inlined with action that caused it in the debugger. You can now even follow a client execution, that triggers a server execution, that errors and runs a catch execution... pretty awesome!\r\n- Debugger now fades out actions that are not run (general improvement), also other general improvements made to debugger\r\n- The `function-tree-firebase-admin` package has changed its API\r\n- `abort` and `retry` are now completely gone. They were not very well thought out ideas. If you have been using `abort`, throw an error instead\r\n- When I played around with this I found issues with `addModule`, now modules are added correctly\r\n- Signals can now be defined as `{signal: [], catch: []}` or `{signal: [], catch: {}}`\r\n- Moved position of \"architecture\" docs, one step up\r\n- Fixed parallel execution to not continue when error has been thrown\r\n- Tutorial is updated using an example of error throwing\r\n- `http-provider` and `firebase-provider` now exports errors\r\n\r\n@Guria Sorry for mixing stuff again, but it was no \"first I want to do this and then this\", I discovered all this stuff along the way to implement it all.. was afraid to forget something. Though maybe split PR on commit per folder or something?\r\n\r\n----\r\n\r\n**This description was updated according final discussions and changes**","created_at":"2017-03-23T21:28:49Z","updated_at":"2017-04-01T09:33:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7a5aec83f256b5e19950fe0c7c1864ee6624e71","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cerebral/cerebral/pulls/793/commits","review_comments_url":"https://api.github.com/repos/cerebral/cerebral/pulls/793/comments","review_comment_url":"https://api.github.com/repos/cerebral/cerebral/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cerebral/cerebral/issues/793/comments","statuses_url":"https://api.github.com/repos/cerebral/cerebral/statuses/8dff2a28659dc9605838c08ba9cb5c44e3e358b0","head":{"label":"cerebral:ftErrors","ref":"ftErrors","sha":"8dff2a28659dc9605838c08ba9cb5c44e3e358b0","user":{"login":"cerebral","id":15994611,"avatar_url":"https://avatars2.githubusercontent.com/u/15994611?v=3","gravatar_id":"","url":"https://api.github.com/users/cerebral","html_url":"https://github.com/cerebral","followers_url":"https://api.github.com/users/cerebral/followers","following_url":"https://api.github.com/users/cerebral/following{/other_user}","gists_url":"https://api.github.com/users/cerebral/gists{/gist_id}","starred_url":"https://api.github.com/users/cerebral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerebral/subscriptions","organizations_url":"https://api.github.com/users/cerebral/orgs","repos_url":"https://api.github.com/users/cerebral/repos","events_url":"https://api.github.com/users/cerebral/events{/privacy}","received_events_url":"https://api.github.com/users/cerebral/received_events","type":"Organization","site_admin":false},"repo":{"id":35326416,"name":"cerebral","full_name":"cerebral/cerebral","owner":{"login":"cerebral","id":15994611,"avatar_url":"https://avatars2.githubusercontent.com/u/15994611?v=3","gravatar_id":"","url":"https://api.github.com/users/cerebral","html_url":"https://github.com/cerebral","followers_url":"https://api.github.com/users/cerebral/followers","following_url":"https://api.github.com/users/cerebral/following{/other_user}","gists_url":"https://api.github.com/users/cerebral/gists{/gist_id}","starred_url":"https://api.github.com/users/cerebral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerebral/subscriptions","organizations_url":"https://api.github.com/users/cerebral/orgs","repos_url":"https://api.github.com/users/cerebral/repos","events_url":"https://api.github.com/users/cerebral/events{/privacy}","received_events_url":"https://api.github.com/users/cerebral/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cerebral/cerebral","description":"A state controller with its own debugger","fork":false,"url":"https://api.github.com/repos/cerebral/cerebral","forks_url":"https://api.github.com/repos/cerebral/cerebral/forks","keys_url":"https://api.github.com/repos/cerebral/cerebral/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cerebral/cerebral/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cerebral/cerebral/teams","hooks_url":"https://api.github.com/repos/cerebral/cerebral/hooks","issue_events_url":"https://api.github.com/repos/cerebral/cerebral/issues/events{/number}","events_url":"https://api.github.com/repos/cerebral/cerebral/events","assignees_url":"https://api.github.com/repos/cerebral/cerebral/assignees{/user}","branches_url":"https://api.github.com/repos/cerebral/cerebral/branches{/branch}","tags_url":"https://api.github.com/repos/cerebral/cerebral/tags","blobs_url":"https://api.github.com/repos/cerebral/cerebral/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cerebral/cerebral/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cerebral/cerebral/git/refs{/sha}","trees_url":"https://api.github.com/repos/cerebral/cerebral/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cerebral/cerebral/statuses/{sha}","languages_url":"https://api.github.com/repos/cerebral/cerebral/languages","stargazers_url":"https://api.github.com/repos/cerebral/cerebral/stargazers","contributors_url":"https://api.github.com/repos/cerebral/cerebral/contributors","subscribers_url":"https://api.github.com/repos/cerebral/cerebral/subscribers","subscription_url":"https://api.github.com/repos/cerebral/cerebral/subscription","commits_url":"https://api.github.com/repos/cerebral/cerebral/commits{/sha}","git_commits_url":"https://api.github.com/repos/cerebral/cerebral/git/commits{/sha}","comments_url":"https://api.github.com/repos/cerebral/cerebral/comments{/number}","issue_comment_url":"https://api.github.com/repos/cerebral/cerebral/issues/comments{/number}","contents_url":"https://api.github.com/repos/cerebral/cerebral/contents/{+path}","compare_url":"https://api.github.com/repos/cerebral/cerebral/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cerebral/cerebral/merges","archive_url":"https://api.github.com/repos/cerebral/cerebral/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cerebral/cerebral/downloads","issues_url":"https://api.github.com/repos/cerebral/cerebral/issues{/number}","pulls_url":"https://api.github.com/repos/cerebral/cerebral/pulls{/number}","milestones_url":"https://api.github.com/repos/cerebral/cerebral/milestones{/number}","notifications_url":"https://api.github.com/repos/cerebral/cerebral/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cerebral/cerebral/labels{/name}","releases_url":"https://api.github.com/repos/cerebral/cerebral/releases{/id}","deployments_url":"https://api.github.com/repos/cerebral/cerebral/deployments","created_at":"2015-05-09T11:40:05Z","updated_at":"2017-03-31T17:04:33Z","pushed_at":"2017-03-31T15:53:13Z","git_url":"git://github.com/cerebral/cerebral.git","ssh_url":"git@github.com:cerebral/cerebral.git","clone_url":"https://github.com/cerebral/cerebral.git","svn_url":"https://github.com/cerebral/cerebral","homepage":"http://cerebraljs.com","size":8550,"stargazers_count":983,"watchers_count":983,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":29,"forks":61,"open_issues":29,"watchers":983,"default_branch":"master"}},"base":{"label":"cerebral:master","ref":"master","sha":"70390ee32b2f59fbfcc20f292403731bb6c8a5a2","user":{"login":"cerebral","id":15994611,"avatar_url":"https://avatars2.githubusercontent.com/u/15994611?v=3","gravatar_id":"","url":"https://api.github.com/users/cerebral","html_url":"https://github.com/cerebral","followers_url":"https://api.github.com/users/cerebral/followers","following_url":"https://api.github.com/users/cerebral/following{/other_user}","gists_url":"https://api.github.com/users/cerebral/gists{/gist_id}","starred_url":"https://api.github.com/users/cerebral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerebral/subscriptions","organizations_url":"https://api.github.com/users/cerebral/orgs","repos_url":"https://api.github.com/users/cerebral/repos","events_url":"https://api.github.com/users/cerebral/events{/privacy}","received_events_url":"https://api.github.com/users/cerebral/received_events","type":"Organization","site_admin":false},"repo":{"id":35326416,"name":"cerebral","full_name":"cerebral/cerebral","owner":{"login":"cerebral","id":15994611,"avatar_url":"https://avatars2.githubusercontent.com/u/15994611?v=3","gravatar_id":"","url":"https://api.github.com/users/cerebral","html_url":"https://github.com/cerebral","followers_url":"https://api.github.com/users/cerebral/followers","following_url":"https://api.github.com/users/cerebral/following{/other_user}","gists_url":"https://api.github.com/users/cerebral/gists{/gist_id}","starred_url":"https://api.github.com/users/cerebral/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cerebral/subscriptions","organizations_url":"https://api.github.com/users/cerebral/orgs","repos_url":"https://api.github.com/users/cerebral/repos","events_url":"https://api.github.com/users/cerebral/events{/privacy}","received_events_url":"https://api.github.com/users/cerebral/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cerebral/cerebral","description":"A state controller with its own debugger","fork":false,"url":"https://api.github.com/repos/cerebral/cerebral","forks_url":"https://api.github.com/repos/cerebral/cerebral/forks","keys_url":"https://api.github.com/repos/cerebral/cerebral/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cerebral/cerebral/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cerebral/cerebral/teams","hooks_url":"https://api.github.com/repos/cerebral/cerebral/hooks","issue_events_url":"https://api.github.com/repos/cerebral/cerebral/issues/events{/number}","events_url":"https://api.github.com/repos/cerebral/cerebral/events","assignees_url":"https://api.github.com/repos/cerebral/cerebral/assignees{/user}","branches_url":"https://api.github.com/repos/cerebral/cerebral/branches{/branch}","tags_url":"https://api.github.com/repos/cerebral/cerebral/tags","blobs_url":"https://api.github.com/repos/cerebral/cerebral/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cerebral/cerebral/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cerebral/cerebral/git/refs{/sha}","trees_url":"https://api.github.com/repos/cerebral/cerebral/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cerebral/cerebral/statuses/{sha}","languages_url":"https://api.github.com/repos/cerebral/cerebral/languages","stargazers_url":"https://api.github.com/repos/cerebral/cerebral/stargazers","contributors_url":"https://api.github.com/repos/cerebral/cerebral/contributors","subscribers_url":"https://api.github.com/repos/cerebral/cerebral/subscribers","subscription_url":"https://api.github.com/repos/cerebral/cerebral/subscription","commits_url":"https://api.github.com/repos/cerebral/cerebral/commits{/sha}","git_commits_url":"https://api.github.com/repos/cerebral/cerebral/git/commits{/sha}","comments_url":"https://api.github.com/repos/cerebral/cerebral/comments{/number}","issue_comment_url":"https://api.github.com/repos/cerebral/cerebral/issues/comments{/number}","contents_url":"https://api.github.com/repos/cerebral/cerebral/contents/{+path}","compare_url":"https://api.github.com/repos/cerebral/cerebral/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cerebral/cerebral/merges","archive_url":"https://api.github.com/repos/cerebral/cerebral/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cerebral/cerebral/downloads","issues_url":"https://api.github.com/repos/cerebral/cerebral/issues{/number}","pulls_url":"https://api.github.com/repos/cerebral/cerebral/pulls{/number}","milestones_url":"https://api.github.com/repos/cerebral/cerebral/milestones{/number}","notifications_url":"https://api.github.com/repos/cerebral/cerebral/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cerebral/cerebral/labels{/name}","releases_url":"https://api.github.com/repos/cerebral/cerebral/releases{/id}","deployments_url":"https://api.github.com/repos/cerebral/cerebral/deployments","created_at":"2015-05-09T11:40:05Z","updated_at":"2017-03-31T17:04:33Z","pushed_at":"2017-03-31T15:53:13Z","git_url":"git://github.com/cerebral/cerebral.git","ssh_url":"git@github.com:cerebral/cerebral.git","clone_url":"https://github.com/cerebral/cerebral.git","svn_url":"https://github.com/cerebral/cerebral","homepage":"http://cerebraljs.com","size":8550,"stargazers_count":983,"watchers_count":983,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":29,"forks":61,"open_issues":29,"watchers":983,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cerebral/cerebral/pulls/793"},"html":{"href":"https://github.com/cerebral/cerebral/pull/793"},"issue":{"href":"https://api.github.com/repos/cerebral/cerebral/issues/793"},"comments":{"href":"https://api.github.com/repos/cerebral/cerebral/issues/793/comments"},"review_comments":{"href":"https://api.github.com/repos/cerebral/cerebral/pulls/793/comments"},"review_comment":{"href":"https://api.github.com/repos/cerebral/cerebral/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cerebral/cerebral/pulls/793/commits"},"statuses":{"href":"https://api.github.com/repos/cerebral/cerebral/statuses/8dff2a28659dc9605838c08ba9cb5c44e3e358b0"}}}}
{"actor":{"display_login":"henri-hulski"}}