{"action":"created","issue":{"url":"https://api.github.com/repos/MatAtBread/nodent/issues/62","repository_url":"https://api.github.com/repos/MatAtBread/nodent","labels_url":"https://api.github.com/repos/MatAtBread/nodent/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/MatAtBread/nodent/issues/62/comments","events_url":"https://api.github.com/repos/MatAtBread/nodent/issues/62/events","html_url":"https://github.com/MatAtBread/nodent/issues/62","id":181069377,"number":62,"title":"Error with try/catch/finally","user":{"login":"SimonDegraeve","id":907187,"avatar_url":"https://avatars.githubusercontent.com/u/907187?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonDegraeve","html_url":"https://github.com/SimonDegraeve","followers_url":"https://api.github.com/users/SimonDegraeve/followers","following_url":"https://api.github.com/users/SimonDegraeve/following{/other_user}","gists_url":"https://api.github.com/users/SimonDegraeve/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonDegraeve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonDegraeve/subscriptions","organizations_url":"https://api.github.com/users/SimonDegraeve/orgs","repos_url":"https://api.github.com/users/SimonDegraeve/repos","events_url":"https://api.github.com/users/SimonDegraeve/events{/privacy}","received_events_url":"https://api.github.com/users/SimonDegraeve/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-05T05:40:07Z","updated_at":"2016-10-05T08:35:55Z","closed_at":null,"body":"```js\r\nconst fn1 = async () => {\r\n  try {\r\n    throw new Error();\r\n  }\r\n  catch (error) {\r\n    // do nothing\r\n  }\r\n  finally {\r\n    return 'ok';\r\n  }\r\n};\r\n```\r\nCompile to\r\n```js\r\nvar fn1 = function fn1() {\r\n  return new Promise(function ($return, $error) {\r\n    try {\r\n      return $error(new Error());\r\n    } catch (error) {\r\n      // do nothing\r\n    } finally {\r\n      return $return('ok');\r\n    }\r\n    return $return();\r\n  }.$asyncbind(undefined));\r\n};\r\n```\r\n**`finally` is never reached**\r\n\r\nSame with\r\n```js\r\nconst fn2 = async () => {\r\n  try {\r\n    return '1';\r\n  }\r\n  finally {\r\n    return '2';\r\n  }\r\n};\r\n```\r\n```js\r\nvar fn2 = function fn2() {\r\n  return new Promise(function ($return, $error) {\r\n    try {\r\n      return $return('1');\r\n    } finally {\r\n      return $return('2');\r\n    }\r\n    return $return();\r\n  }.$asyncbind(undefined));\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/MatAtBread/nodent/issues/comments/251615056","html_url":"https://github.com/MatAtBread/nodent/issues/62#issuecomment-251615056","issue_url":"https://api.github.com/repos/MatAtBread/nodent/issues/62","id":251615056,"user":{"login":"epoberezkin","id":2769109,"avatar_url":"https://avatars.githubusercontent.com/u/2769109?v=3","gravatar_id":"","url":"https://api.github.com/users/epoberezkin","html_url":"https://github.com/epoberezkin","followers_url":"https://api.github.com/users/epoberezkin/followers","following_url":"https://api.github.com/users/epoberezkin/following{/other_user}","gists_url":"https://api.github.com/users/epoberezkin/gists{/gist_id}","starred_url":"https://api.github.com/users/epoberezkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epoberezkin/subscriptions","organizations_url":"https://api.github.com/users/epoberezkin/orgs","repos_url":"https://api.github.com/users/epoberezkin/repos","events_url":"https://api.github.com/users/epoberezkin/events{/privacy}","received_events_url":"https://api.github.com/users/epoberezkin/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T08:35:55Z","updated_at":"2016-10-05T08:35:55Z","body":"I see. So finally gets reached, just after the promise is resolved..."}}
{"actor":{"display_login":"epoberezkin"}}