{"action":"created","issue":{"url":"https://api.github.com/repos/othiym23/async-listener/issues/45","labels_url":"https://api.github.com/repos/othiym23/async-listener/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/othiym23/async-listener/issues/45/comments","events_url":"https://api.github.com/repos/othiym23/async-listener/issues/45/events","html_url":"https://github.com/othiym23/async-listener/issues/45","id":116858412,"number":45,"title":"Context not preserved after Promise.catch","user":{"login":"wonnage","id":125177,"avatar_url":"https://avatars.githubusercontent.com/u/125177?v=3","gravatar_id":"","url":"https://api.github.com/users/wonnage","html_url":"https://github.com/wonnage","followers_url":"https://api.github.com/users/wonnage/followers","following_url":"https://api.github.com/users/wonnage/following{/other_user}","gists_url":"https://api.github.com/users/wonnage/gists{/gist_id}","starred_url":"https://api.github.com/users/wonnage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wonnage/subscriptions","organizations_url":"https://api.github.com/users/wonnage/orgs","repos_url":"https://api.github.com/users/wonnage/repos","events_url":"https://api.github.com/users/wonnage/events{/privacy}","received_events_url":"https://api.github.com/users/wonnage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-13T21:43:36Z","updated_at":"2015-11-13T21:44:21Z","closed_at":null,"body":"```\r\nconst cls = require('continuation-local-storage')\r\nconst context = cls.createNamespace('context')\r\ncontext.run(() => { \r\n  context.set('foo', 3); \r\n  Promise.resolve('test')\r\n    .then(() => console.log(cls.getNamespace('context').get('foo'))) \r\n})\r\n\r\n=> 3\r\n\r\nconst cls = require('continuation-local-storage')\r\nconst context = cls.createNamespace('context')\r\ncontext.run(() => { \r\n  context.set('foo', 3); \r\n  Promise.resolve('test')\r\n    .catch(() => {})\r\n    .then(() => console.log(cls.getNamespace('context').get('foo'))) \r\n})\r\n\r\n=> undefined\r\n````"},"comment":{"url":"https://api.github.com/repos/othiym23/async-listener/issues/comments/156566080","html_url":"https://github.com/othiym23/async-listener/issues/45#issuecomment-156566080","issue_url":"https://api.github.com/repos/othiym23/async-listener/issues/45","id":156566080,"user":{"login":"wonnage","id":125177,"avatar_url":"https://avatars.githubusercontent.com/u/125177?v=3","gravatar_id":"","url":"https://api.github.com/users/wonnage","html_url":"https://github.com/wonnage","followers_url":"https://api.github.com/users/wonnage/followers","following_url":"https://api.github.com/users/wonnage/following{/other_user}","gists_url":"https://api.github.com/users/wonnage/gists{/gist_id}","starred_url":"https://api.github.com/users/wonnage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wonnage/subscriptions","organizations_url":"https://api.github.com/users/wonnage/orgs","repos_url":"https://api.github.com/users/wonnage/repos","events_url":"https://api.github.com/users/wonnage/events{/privacy}","received_events_url":"https://api.github.com/users/wonnage/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T21:44:21Z","updated_at":"2015-11-13T21:44:21Z","body":"Looks like the context is not preserved if you chain a catch and it's not hit (i.e, the promise was not actually rejected)"}}