{"action":"created","comment":{"url":"https://api.github.com/repos/RackHD/on-http/pulls/comments/58180742","id":58180742,"diff_hunk":"@@ -128,7 +128,56 @@ function workflowApiServiceFactory(\n     };\n \n     WorkflowApiService.prototype.cancelTaskGraph = function(graphId) {\n-        return taskGraphProtocol.cancelTaskGraph(graphId);\n+        var instanceId;\n+\n+        return waterline.graphobjects.needByIdentifier(graphId)\n+        .then(function(workflow) {\n+            instanceId = workflow.instanceId;\n+\n+            if (workflow.active()) {\n+                return taskGraphProtocol.cancelTaskGraph(instanceId);\n+            }\n+            throw new Errors.TaskCancellationError(\n+                graphId + ' is not an active workflow'\n+            );","path":"lib/services/workflow-api-service.js","position":16,"original_position":16,"commit_id":"3d34b8d06fcd20c1ee7d6e4e497f5165bcc10ddf","original_commit_id":"3d34b8d06fcd20c1ee7d6e4e497f5165bcc10ddf","user":{"login":"yyscamper","id":511378,"avatar_url":"https://avatars.githubusercontent.com/u/511378?v=3","gravatar_id":"","url":"https://api.github.com/users/yyscamper","html_url":"https://github.com/yyscamper","followers_url":"https://api.github.com/users/yyscamper/followers","following_url":"https://api.github.com/users/yyscamper/following{/other_user}","gists_url":"https://api.github.com/users/yyscamper/gists{/gist_id}","starred_url":"https://api.github.com/users/yyscamper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yyscamper/subscriptions","organizations_url":"https://api.github.com/users/yyscamper/orgs","repos_url":"https://api.github.com/users/yyscamper/repos","events_url":"https://api.github.com/users/yyscamper/events{/privacy}","received_events_url":"https://api.github.com/users/yyscamper/received_events","type":"User","site_admin":false},"body":"This is another case for my above concern about putting error handling into branch. But this case is a little nicer than above because it is not in the end of the function.","created_at":"2016-04-01T09:13:39Z","updated_at":"2016-04-01T09:13:39Z","html_url":"https://github.com/RackHD/on-http/pull/194#discussion_r58180742","pull_request_url":"https://api.github.com/repos/RackHD/on-http/pulls/194","_links":{"self":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/comments/58180742"},"html":{"href":"https://github.com/RackHD/on-http/pull/194#discussion_r58180742"},"pull_request":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/194"}}},"pull_request":{"url":"https://api.github.com/repos/RackHD/on-http/pulls/194","id":64476300,"html_url":"https://github.com/RackHD/on-http/pull/194","diff_url":"https://github.com/RackHD/on-http/pull/194.diff","patch_url":"https://github.com/RackHD/on-http/pull/194.patch","issue_url":"https://api.github.com/repos/RackHD/on-http/issues/194","number":194,"state":"open","locked":false,"title":"Add v2.0 workflows API","user":{"login":"brianparry","id":13092640,"avatar_url":"https://avatars.githubusercontent.com/u/13092640?v=3","gravatar_id":"","url":"https://api.github.com/users/brianparry","html_url":"https://github.com/brianparry","followers_url":"https://api.github.com/users/brianparry/followers","following_url":"https://api.github.com/users/brianparry/following{/other_user}","gists_url":"https://api.github.com/users/brianparry/gists{/gist_id}","starred_url":"https://api.github.com/users/brianparry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianparry/subscriptions","organizations_url":"https://api.github.com/users/brianparry/orgs","repos_url":"https://api.github.com/users/brianparry/repos","events_url":"https://api.github.com/users/brianparry/events{/privacy}","received_events_url":"https://api.github.com/users/brianparry/received_events","type":"User","site_admin":false},"body":"* GET, POST, DELETE, cancel a workflow.\r\n* GET, PUT, DELETE a graph definition.\r\n* GET, PUT, DELETE a task definition.\r\n* active query param to workflows route\r\n\r\nSeparate the workflows routes into workflows /workflows/graphs and /workflows/tasks.  The graphs route is used for graph definitions. ant the tasks route is used for task definitions  Some semantics are now inconsistent with /nodes/:identifier/workflows.  This will be cleaned up in another PR.\r\n\r\nSee https://groups.google.com/forum/#!topic/rackhd/SvggYYKeeaQ for more detailed discussion.\r\n\r\nThis change has contributions from @dalebremner @abildw and @srinia6 \r\n\r\nDepends on https://github.com/RackHD/on-core/pull/107","created_at":"2016-03-29T14:39:53Z","updated_at":"2016-04-01T09:13:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82f130e755052cf90e378774160c64af8a46ee9c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RackHD/on-http/pulls/194/commits","review_comments_url":"https://api.github.com/repos/RackHD/on-http/pulls/194/comments","review_comment_url":"https://api.github.com/repos/RackHD/on-http/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RackHD/on-http/issues/194/comments","statuses_url":"https://api.github.com/repos/RackHD/on-http/statuses/3d34b8d06fcd20c1ee7d6e4e497f5165bcc10ddf","head":{"label":"brianparry:workflows-rebased","ref":"workflows-rebased","sha":"3d34b8d06fcd20c1ee7d6e4e497f5165bcc10ddf","user":{"login":"brianparry","id":13092640,"avatar_url":"https://avatars.githubusercontent.com/u/13092640?v=3","gravatar_id":"","url":"https://api.github.com/users/brianparry","html_url":"https://github.com/brianparry","followers_url":"https://api.github.com/users/brianparry/followers","following_url":"https://api.github.com/users/brianparry/following{/other_user}","gists_url":"https://api.github.com/users/brianparry/gists{/gist_id}","starred_url":"https://api.github.com/users/brianparry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianparry/subscriptions","organizations_url":"https://api.github.com/users/brianparry/orgs","repos_url":"https://api.github.com/users/brianparry/repos","events_url":"https://api.github.com/users/brianparry/events{/privacy}","received_events_url":"https://api.github.com/users/brianparry/received_events","type":"User","site_admin":false},"repo":{"id":49208460,"name":"on-http","full_name":"brianparry/on-http","owner":{"login":"brianparry","id":13092640,"avatar_url":"https://avatars.githubusercontent.com/u/13092640?v=3","gravatar_id":"","url":"https://api.github.com/users/brianparry","html_url":"https://github.com/brianparry","followers_url":"https://api.github.com/users/brianparry/followers","following_url":"https://api.github.com/users/brianparry/following{/other_user}","gists_url":"https://api.github.com/users/brianparry/gists{/gist_id}","starred_url":"https://api.github.com/users/brianparry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianparry/subscriptions","organizations_url":"https://api.github.com/users/brianparry/orgs","repos_url":"https://api.github.com/users/brianparry/repos","events_url":"https://api.github.com/users/brianparry/events{/privacy}","received_events_url":"https://api.github.com/users/brianparry/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brianparry/on-http","description":"","fork":true,"url":"https://api.github.com/repos/brianparry/on-http","forks_url":"https://api.github.com/repos/brianparry/on-http/forks","keys_url":"https://api.github.com/repos/brianparry/on-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brianparry/on-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brianparry/on-http/teams","hooks_url":"https://api.github.com/repos/brianparry/on-http/hooks","issue_events_url":"https://api.github.com/repos/brianparry/on-http/issues/events{/number}","events_url":"https://api.github.com/repos/brianparry/on-http/events","assignees_url":"https://api.github.com/repos/brianparry/on-http/assignees{/user}","branches_url":"https://api.github.com/repos/brianparry/on-http/branches{/branch}","tags_url":"https://api.github.com/repos/brianparry/on-http/tags","blobs_url":"https://api.github.com/repos/brianparry/on-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brianparry/on-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brianparry/on-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/brianparry/on-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brianparry/on-http/statuses/{sha}","languages_url":"https://api.github.com/repos/brianparry/on-http/languages","stargazers_url":"https://api.github.com/repos/brianparry/on-http/stargazers","contributors_url":"https://api.github.com/repos/brianparry/on-http/contributors","subscribers_url":"https://api.github.com/repos/brianparry/on-http/subscribers","subscription_url":"https://api.github.com/repos/brianparry/on-http/subscription","commits_url":"https://api.github.com/repos/brianparry/on-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/brianparry/on-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/brianparry/on-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/brianparry/on-http/issues/comments{/number}","contents_url":"https://api.github.com/repos/brianparry/on-http/contents/{+path}","compare_url":"https://api.github.com/repos/brianparry/on-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brianparry/on-http/merges","archive_url":"https://api.github.com/repos/brianparry/on-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brianparry/on-http/downloads","issues_url":"https://api.github.com/repos/brianparry/on-http/issues{/number}","pulls_url":"https://api.github.com/repos/brianparry/on-http/pulls{/number}","milestones_url":"https://api.github.com/repos/brianparry/on-http/milestones{/number}","notifications_url":"https://api.github.com/repos/brianparry/on-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brianparry/on-http/labels{/name}","releases_url":"https://api.github.com/repos/brianparry/on-http/releases{/id}","deployments_url":"https://api.github.com/repos/brianparry/on-http/deployments","created_at":"2016-01-07T14:13:21Z","updated_at":"2016-01-07T14:13:22Z","pushed_at":"2016-03-31T18:43:49Z","git_url":"git://github.com/brianparry/on-http.git","ssh_url":"git@github.com:brianparry/on-http.git","clone_url":"https://github.com/brianparry/on-http.git","svn_url":"https://github.com/brianparry/on-http","homepage":null,"size":2277,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"RackHD:master","ref":"master","sha":"e78467d34a9ac3fa08a0396d5320dfce6646795a","user":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"repo":{"id":41690081,"name":"on-http","full_name":"RackHD/on-http","owner":{"login":"RackHD","id":13982662,"avatar_url":"https://avatars.githubusercontent.com/u/13982662?v=3","gravatar_id":"","url":"https://api.github.com/users/RackHD","html_url":"https://github.com/RackHD","followers_url":"https://api.github.com/users/RackHD/followers","following_url":"https://api.github.com/users/RackHD/following{/other_user}","gists_url":"https://api.github.com/users/RackHD/gists{/gist_id}","starred_url":"https://api.github.com/users/RackHD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RackHD/subscriptions","organizations_url":"https://api.github.com/users/RackHD/orgs","repos_url":"https://api.github.com/users/RackHD/repos","events_url":"https://api.github.com/users/RackHD/events{/privacy}","received_events_url":"https://api.github.com/users/RackHD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RackHD/on-http","description":"","fork":false,"url":"https://api.github.com/repos/RackHD/on-http","forks_url":"https://api.github.com/repos/RackHD/on-http/forks","keys_url":"https://api.github.com/repos/RackHD/on-http/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RackHD/on-http/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RackHD/on-http/teams","hooks_url":"https://api.github.com/repos/RackHD/on-http/hooks","issue_events_url":"https://api.github.com/repos/RackHD/on-http/issues/events{/number}","events_url":"https://api.github.com/repos/RackHD/on-http/events","assignees_url":"https://api.github.com/repos/RackHD/on-http/assignees{/user}","branches_url":"https://api.github.com/repos/RackHD/on-http/branches{/branch}","tags_url":"https://api.github.com/repos/RackHD/on-http/tags","blobs_url":"https://api.github.com/repos/RackHD/on-http/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RackHD/on-http/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RackHD/on-http/git/refs{/sha}","trees_url":"https://api.github.com/repos/RackHD/on-http/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RackHD/on-http/statuses/{sha}","languages_url":"https://api.github.com/repos/RackHD/on-http/languages","stargazers_url":"https://api.github.com/repos/RackHD/on-http/stargazers","contributors_url":"https://api.github.com/repos/RackHD/on-http/contributors","subscribers_url":"https://api.github.com/repos/RackHD/on-http/subscribers","subscription_url":"https://api.github.com/repos/RackHD/on-http/subscription","commits_url":"https://api.github.com/repos/RackHD/on-http/commits{/sha}","git_commits_url":"https://api.github.com/repos/RackHD/on-http/git/commits{/sha}","comments_url":"https://api.github.com/repos/RackHD/on-http/comments{/number}","issue_comment_url":"https://api.github.com/repos/RackHD/on-http/issues/comments{/number}","contents_url":"https://api.github.com/repos/RackHD/on-http/contents/{+path}","compare_url":"https://api.github.com/repos/RackHD/on-http/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RackHD/on-http/merges","archive_url":"https://api.github.com/repos/RackHD/on-http/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RackHD/on-http/downloads","issues_url":"https://api.github.com/repos/RackHD/on-http/issues{/number}","pulls_url":"https://api.github.com/repos/RackHD/on-http/pulls{/number}","milestones_url":"https://api.github.com/repos/RackHD/on-http/milestones{/number}","notifications_url":"https://api.github.com/repos/RackHD/on-http/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RackHD/on-http/labels{/name}","releases_url":"https://api.github.com/repos/RackHD/on-http/releases{/id}","deployments_url":"https://api.github.com/repos/RackHD/on-http/deployments","created_at":"2015-08-31T17:29:08Z","updated_at":"2016-01-31T09:01:04Z","pushed_at":"2016-03-31T21:32:40Z","git_url":"git://github.com/RackHD/on-http.git","ssh_url":"git@github.com:RackHD/on-http.git","clone_url":"https://github.com/RackHD/on-http.git","svn_url":"https://github.com/RackHD/on-http","homepage":null,"size":2641,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":38,"mirror_url":null,"open_issues_count":4,"forks":38,"open_issues":4,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/194"},"html":{"href":"https://github.com/RackHD/on-http/pull/194"},"issue":{"href":"https://api.github.com/repos/RackHD/on-http/issues/194"},"comments":{"href":"https://api.github.com/repos/RackHD/on-http/issues/194/comments"},"review_comments":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/194/comments"},"review_comment":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RackHD/on-http/pulls/194/commits"},"statuses":{"href":"https://api.github.com/repos/RackHD/on-http/statuses/3d34b8d06fcd20c1ee7d6e4e497f5165bcc10ddf"}}}}