{"action":"created","issue":{"url":"https://api.github.com/repos/getify/asynquence/issues/81","repository_url":"https://api.github.com/repos/getify/asynquence","labels_url":"https://api.github.com/repos/getify/asynquence/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/getify/asynquence/issues/81/comments","events_url":"https://api.github.com/repos/getify/asynquence/issues/81/events","html_url":"https://github.com/getify/asynquence/issues/81","id":131378560,"number":81,"title":"Confused about .or()","user":{"login":"richb-hanover","id":1094930,"avatar_url":"https://avatars.githubusercontent.com/u/1094930?v=3","gravatar_id":"","url":"https://api.github.com/users/richb-hanover","html_url":"https://github.com/richb-hanover","followers_url":"https://api.github.com/users/richb-hanover/followers","following_url":"https://api.github.com/users/richb-hanover/following{/other_user}","gists_url":"https://api.github.com/users/richb-hanover/gists{/gist_id}","starred_url":"https://api.github.com/users/richb-hanover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richb-hanover/subscriptions","organizations_url":"https://api.github.com/users/richb-hanover/orgs","repos_url":"https://api.github.com/users/richb-hanover/repos","events_url":"https://api.github.com/users/richb-hanover/events{/privacy}","received_events_url":"https://api.github.com/users/richb-hanover/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-04T15:15:13Z","updated_at":"2016-02-04T18:27:35Z","closed_at":null,"body":"ASQ is very cool stuff. I am new to it, and was playing with an expanded copy of the first example in Part 1 of the davidwalsh.name blog (https://davidwalsh.name/asynquence-part-1).\r\n\r\nIf I throw an exception in a .then() block, all is well - .or() handles it. But if I throw an exception in the callback of the .then(), the .or() handler never gets called. \r\n\r\n**Example:** Here's a [jsfiddle](https://jsfiddle.net/richbhanover/y34j8k0j/) that shows my tests:\r\n\r\n- If I uncomment the first throw statement (in Step 3b), all is fine.\r\n- If I uncomment the second (inside the setTimeout() callback), the exception is not caught. Neither step4() nor the .on() get called.\r\n\r\nIn my read of the site, the post on David Walsh's site, and the Book (I bought it - thanks!) I understood that .on() would be able to catch all the errors. What have I misunderstood? How can I protect my code?"},"comment":{"url":"https://api.github.com/repos/getify/asynquence/issues/comments/179982495","html_url":"https://github.com/getify/asynquence/issues/81#issuecomment-179982495","issue_url":"https://api.github.com/repos/getify/asynquence/issues/81","id":179982495,"user":{"login":"richb-hanover","id":1094930,"avatar_url":"https://avatars.githubusercontent.com/u/1094930?v=3","gravatar_id":"","url":"https://api.github.com/users/richb-hanover","html_url":"https://github.com/richb-hanover","followers_url":"https://api.github.com/users/richb-hanover/followers","following_url":"https://api.github.com/users/richb-hanover/following{/other_user}","gists_url":"https://api.github.com/users/richb-hanover/gists{/gist_id}","starred_url":"https://api.github.com/users/richb-hanover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richb-hanover/subscriptions","organizations_url":"https://api.github.com/users/richb-hanover/orgs","repos_url":"https://api.github.com/users/richb-hanover/repos","events_url":"https://api.github.com/users/richb-hanover/events{/privacy}","received_events_url":"https://api.github.com/users/richb-hanover/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T18:27:35Z","updated_at":"2016-02-04T18:27:35Z","body":"re: .or() D'oh! \r\n\r\nre: exceptions inside async callback. I can wrap my async callback in try/catch, and that will, of course handle the error. \r\n\r\nBut it sounds as if there's no way to get word back to the sequence from async-callback-land that something bad has happened... Is that correct? Thanks again."}}