{"action":"created","issue":{"url":"https://api.github.com/repos/johntitus/node-horseman/issues/196","repository_url":"https://api.github.com/repos/johntitus/node-horseman","labels_url":"https://api.github.com/repos/johntitus/node-horseman/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/johntitus/node-horseman/issues/196/comments","events_url":"https://api.github.com/repos/johntitus/node-horseman/issues/196/events","html_url":"https://github.com/johntitus/node-horseman/issues/196","id":160208260,"number":196,"title":"Can't close horseman instance from extension handlers","user":{"login":"alecarg","id":1661802,"avatar_url":"https://avatars.githubusercontent.com/u/1661802?v=3","gravatar_id":"","url":"https://api.github.com/users/alecarg","html_url":"https://github.com/alecarg","followers_url":"https://api.github.com/users/alecarg/followers","following_url":"https://api.github.com/users/alecarg/following{/other_user}","gists_url":"https://api.github.com/users/alecarg/gists{/gist_id}","starred_url":"https://api.github.com/users/alecarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecarg/subscriptions","organizations_url":"https://api.github.com/users/alecarg/orgs","repos_url":"https://api.github.com/users/alecarg/repos","events_url":"https://api.github.com/users/alecarg/events{/privacy}","received_events_url":"https://api.github.com/users/alecarg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-06-14T15:15:45Z","updated_at":"2016-06-15T15:58:20Z","closed_at":null,"body":"I might be implementing this the wrong way, but here goes one or two cases that fail for me that I would expect them to work:\r\n\r\n```javascript\r\nHorseman.registerAction('evaluateAndCatch', function(fn) {\r\n  var self = this;\r\n  return this\r\n  \t.evaluate(fn)\r\n\t.catch(function(err){\r\n\t\treturn self.close(); // this does not close the instance\r\n\t});\r\n});\r\n```\r\n\r\n--------\r\n\r\n```javascript\r\nHorseman.registerAction('start', function() {\r\n  var self = this;\r\n  return this\r\n\t.on('timeout', function(msg){\r\n\t\treturn self.close(); // this does not close the instance\r\n\t})\r\n}\r\n```\r\n\r\nIt feels like I'd need to reject the promise as well as attempting to close(); in both scenarios. Could that be the problem?\r\nBtw, not sure if the following would work (outside extension handlers).\r\n\r\n```javascript\r\nhorseman\r\n  .on('timeout', function( msg ){\r\n    horseman.close();\r\n  })\r\n```\r\n\r\nAny help would be greatly appreciated."},"comment":{"url":"https://api.github.com/repos/johntitus/node-horseman/issues/comments/226233605","html_url":"https://github.com/johntitus/node-horseman/issues/196#issuecomment-226233605","issue_url":"https://api.github.com/repos/johntitus/node-horseman/issues/196","id":226233605,"user":{"login":"alecarg","id":1661802,"avatar_url":"https://avatars.githubusercontent.com/u/1661802?v=3","gravatar_id":"","url":"https://api.github.com/users/alecarg","html_url":"https://github.com/alecarg","followers_url":"https://api.github.com/users/alecarg/followers","following_url":"https://api.github.com/users/alecarg/following{/other_user}","gists_url":"https://api.github.com/users/alecarg/gists{/gist_id}","starred_url":"https://api.github.com/users/alecarg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecarg/subscriptions","organizations_url":"https://api.github.com/users/alecarg/orgs","repos_url":"https://api.github.com/users/alecarg/repos","events_url":"https://api.github.com/users/alecarg/events{/privacy}","received_events_url":"https://api.github.com/users/alecarg/received_events","type":"User","site_admin":false},"created_at":"2016-06-15T15:58:20Z","updated_at":"2016-06-15T15:58:20Z","body":"@awlayton , thanks.\r\n\r\nI was console logging from inside the onTimeout and catch handlers, but it would seem like (2) might answer (1) then: I was expecting close() to stop the chain.\r\n\r\nWhat would be the correct way to stop the chain then?"}}
{"actor":{"display_login":"alecarg"}}