{"action":"opened","number":1196,"pull_request":{"url":"https://api.github.com/repos/petkaantonov/bluebird/pulls/1196","id":81188552,"html_url":"https://github.com/petkaantonov/bluebird/pull/1196","diff_url":"https://github.com/petkaantonov/bluebird/pull/1196.diff","patch_url":"https://github.com/petkaantonov/bluebird/pull/1196.patch","issue_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/1196","number":1196,"state":"open","locked":false,"title":"asCallback creates a new promise and continues the chain","user":{"login":"ben-page","id":744035,"avatar_url":"https://avatars.githubusercontent.com/u/744035?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-page","html_url":"https://github.com/ben-page","followers_url":"https://api.github.com/users/ben-page/followers","following_url":"https://api.github.com/users/ben-page/following{/other_user}","gists_url":"https://api.github.com/users/ben-page/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-page/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-page/subscriptions","organizations_url":"https://api.github.com/users/ben-page/orgs","repos_url":"https://api.github.com/users/ben-page/repos","events_url":"https://api.github.com/users/ben-page/events{/privacy}","received_events_url":"https://api.github.com/users/ben-page/received_events","type":"User","site_admin":false},"body":"This is an alternative solution to the problem discussed in #1194. It changes `asCallback` return a new promise that resolves to the result of the callback or rejects to errors thrown in the callback.\r\n\r\n```javascript\r\nPromise.resolve(true)\r\n    .asCallback(function (err, v) {\r\n        return 'text';\r\n    })\r\n    .then(v => {\r\n        console.log(v); //text\r\n    });\r\n\r\nPromise.resolve(true)\r\n    .asCallback(function (err, v) {\r\n        throw new Error('error');\r\n    })\r\n    .catch(err => {\r\n        console.log(err.message); //error\r\n    });\r\n```","created_at":"2016-08-12T21:54:08Z","updated_at":"2016-08-12T21:54:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/petkaantonov/bluebird/pulls/1196/commits","review_comments_url":"https://api.github.com/repos/petkaantonov/bluebird/pulls/1196/comments","review_comment_url":"https://api.github.com/repos/petkaantonov/bluebird/pulls/comments{/number}","comments_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/1196/comments","statuses_url":"https://api.github.com/repos/petkaantonov/bluebird/statuses/7586d62ce779424bd2570d35b1344cf2a8f4823f","head":{"label":"ben-page:asCallback-continues","ref":"asCallback-continues","sha":"7586d62ce779424bd2570d35b1344cf2a8f4823f","user":{"login":"ben-page","id":744035,"avatar_url":"https://avatars.githubusercontent.com/u/744035?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-page","html_url":"https://github.com/ben-page","followers_url":"https://api.github.com/users/ben-page/followers","following_url":"https://api.github.com/users/ben-page/following{/other_user}","gists_url":"https://api.github.com/users/ben-page/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-page/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-page/subscriptions","organizations_url":"https://api.github.com/users/ben-page/orgs","repos_url":"https://api.github.com/users/ben-page/repos","events_url":"https://api.github.com/users/ben-page/events{/privacy}","received_events_url":"https://api.github.com/users/ben-page/received_events","type":"User","site_admin":false},"repo":{"id":65039138,"name":"bluebird","full_name":"ben-page/bluebird","owner":{"login":"ben-page","id":744035,"avatar_url":"https://avatars.githubusercontent.com/u/744035?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-page","html_url":"https://github.com/ben-page","followers_url":"https://api.github.com/users/ben-page/followers","following_url":"https://api.github.com/users/ben-page/following{/other_user}","gists_url":"https://api.github.com/users/ben-page/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-page/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-page/subscriptions","organizations_url":"https://api.github.com/users/ben-page/orgs","repos_url":"https://api.github.com/users/ben-page/repos","events_url":"https://api.github.com/users/ben-page/events{/privacy}","received_events_url":"https://api.github.com/users/ben-page/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ben-page/bluebird","description":":bird: :zap: Bluebird is a full featured promise library with unmatched performance.","fork":true,"url":"https://api.github.com/repos/ben-page/bluebird","forks_url":"https://api.github.com/repos/ben-page/bluebird/forks","keys_url":"https://api.github.com/repos/ben-page/bluebird/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ben-page/bluebird/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ben-page/bluebird/teams","hooks_url":"https://api.github.com/repos/ben-page/bluebird/hooks","issue_events_url":"https://api.github.com/repos/ben-page/bluebird/issues/events{/number}","events_url":"https://api.github.com/repos/ben-page/bluebird/events","assignees_url":"https://api.github.com/repos/ben-page/bluebird/assignees{/user}","branches_url":"https://api.github.com/repos/ben-page/bluebird/branches{/branch}","tags_url":"https://api.github.com/repos/ben-page/bluebird/tags","blobs_url":"https://api.github.com/repos/ben-page/bluebird/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ben-page/bluebird/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ben-page/bluebird/git/refs{/sha}","trees_url":"https://api.github.com/repos/ben-page/bluebird/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ben-page/bluebird/statuses/{sha}","languages_url":"https://api.github.com/repos/ben-page/bluebird/languages","stargazers_url":"https://api.github.com/repos/ben-page/bluebird/stargazers","contributors_url":"https://api.github.com/repos/ben-page/bluebird/contributors","subscribers_url":"https://api.github.com/repos/ben-page/bluebird/subscribers","subscription_url":"https://api.github.com/repos/ben-page/bluebird/subscription","commits_url":"https://api.github.com/repos/ben-page/bluebird/commits{/sha}","git_commits_url":"https://api.github.com/repos/ben-page/bluebird/git/commits{/sha}","comments_url":"https://api.github.com/repos/ben-page/bluebird/comments{/number}","issue_comment_url":"https://api.github.com/repos/ben-page/bluebird/issues/comments{/number}","contents_url":"https://api.github.com/repos/ben-page/bluebird/contents/{+path}","compare_url":"https://api.github.com/repos/ben-page/bluebird/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ben-page/bluebird/merges","archive_url":"https://api.github.com/repos/ben-page/bluebird/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ben-page/bluebird/downloads","issues_url":"https://api.github.com/repos/ben-page/bluebird/issues{/number}","pulls_url":"https://api.github.com/repos/ben-page/bluebird/pulls{/number}","milestones_url":"https://api.github.com/repos/ben-page/bluebird/milestones{/number}","notifications_url":"https://api.github.com/repos/ben-page/bluebird/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ben-page/bluebird/labels{/name}","releases_url":"https://api.github.com/repos/ben-page/bluebird/releases{/id}","deployments_url":"https://api.github.com/repos/ben-page/bluebird/deployments","created_at":"2016-08-05T18:06:49Z","updated_at":"2016-08-05T18:06:53Z","pushed_at":"2016-08-12T21:50:50Z","git_url":"git://github.com/ben-page/bluebird.git","ssh_url":"git@github.com:ben-page/bluebird.git","clone_url":"https://github.com/ben-page/bluebird.git","svn_url":"https://github.com/ben-page/bluebird","homepage":"http://bluebirdjs.com","size":13502,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"petkaantonov:master","ref":"master","sha":"d71d04a1e08e63da6554ac833c2e3378727069e6","user":{"login":"petkaantonov","id":829734,"avatar_url":"https://avatars.githubusercontent.com/u/829734?v=3","gravatar_id":"","url":"https://api.github.com/users/petkaantonov","html_url":"https://github.com/petkaantonov","followers_url":"https://api.github.com/users/petkaantonov/followers","following_url":"https://api.github.com/users/petkaantonov/following{/other_user}","gists_url":"https://api.github.com/users/petkaantonov/gists{/gist_id}","starred_url":"https://api.github.com/users/petkaantonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petkaantonov/subscriptions","organizations_url":"https://api.github.com/users/petkaantonov/orgs","repos_url":"https://api.github.com/users/petkaantonov/repos","events_url":"https://api.github.com/users/petkaantonov/events{/privacy}","received_events_url":"https://api.github.com/users/petkaantonov/received_events","type":"User","site_admin":false},"repo":{"id":12670444,"name":"bluebird","full_name":"petkaantonov/bluebird","owner":{"login":"petkaantonov","id":829734,"avatar_url":"https://avatars.githubusercontent.com/u/829734?v=3","gravatar_id":"","url":"https://api.github.com/users/petkaantonov","html_url":"https://github.com/petkaantonov","followers_url":"https://api.github.com/users/petkaantonov/followers","following_url":"https://api.github.com/users/petkaantonov/following{/other_user}","gists_url":"https://api.github.com/users/petkaantonov/gists{/gist_id}","starred_url":"https://api.github.com/users/petkaantonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petkaantonov/subscriptions","organizations_url":"https://api.github.com/users/petkaantonov/orgs","repos_url":"https://api.github.com/users/petkaantonov/repos","events_url":"https://api.github.com/users/petkaantonov/events{/privacy}","received_events_url":"https://api.github.com/users/petkaantonov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petkaantonov/bluebird","description":":bird: :zap: Bluebird is a full featured promise library with unmatched performance.","fork":false,"url":"https://api.github.com/repos/petkaantonov/bluebird","forks_url":"https://api.github.com/repos/petkaantonov/bluebird/forks","keys_url":"https://api.github.com/repos/petkaantonov/bluebird/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petkaantonov/bluebird/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petkaantonov/bluebird/teams","hooks_url":"https://api.github.com/repos/petkaantonov/bluebird/hooks","issue_events_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/events{/number}","events_url":"https://api.github.com/repos/petkaantonov/bluebird/events","assignees_url":"https://api.github.com/repos/petkaantonov/bluebird/assignees{/user}","branches_url":"https://api.github.com/repos/petkaantonov/bluebird/branches{/branch}","tags_url":"https://api.github.com/repos/petkaantonov/bluebird/tags","blobs_url":"https://api.github.com/repos/petkaantonov/bluebird/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petkaantonov/bluebird/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petkaantonov/bluebird/git/refs{/sha}","trees_url":"https://api.github.com/repos/petkaantonov/bluebird/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petkaantonov/bluebird/statuses/{sha}","languages_url":"https://api.github.com/repos/petkaantonov/bluebird/languages","stargazers_url":"https://api.github.com/repos/petkaantonov/bluebird/stargazers","contributors_url":"https://api.github.com/repos/petkaantonov/bluebird/contributors","subscribers_url":"https://api.github.com/repos/petkaantonov/bluebird/subscribers","subscription_url":"https://api.github.com/repos/petkaantonov/bluebird/subscription","commits_url":"https://api.github.com/repos/petkaantonov/bluebird/commits{/sha}","git_commits_url":"https://api.github.com/repos/petkaantonov/bluebird/git/commits{/sha}","comments_url":"https://api.github.com/repos/petkaantonov/bluebird/comments{/number}","issue_comment_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/comments{/number}","contents_url":"https://api.github.com/repos/petkaantonov/bluebird/contents/{+path}","compare_url":"https://api.github.com/repos/petkaantonov/bluebird/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petkaantonov/bluebird/merges","archive_url":"https://api.github.com/repos/petkaantonov/bluebird/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petkaantonov/bluebird/downloads","issues_url":"https://api.github.com/repos/petkaantonov/bluebird/issues{/number}","pulls_url":"https://api.github.com/repos/petkaantonov/bluebird/pulls{/number}","milestones_url":"https://api.github.com/repos/petkaantonov/bluebird/milestones{/number}","notifications_url":"https://api.github.com/repos/petkaantonov/bluebird/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petkaantonov/bluebird/labels{/name}","releases_url":"https://api.github.com/repos/petkaantonov/bluebird/releases{/id}","deployments_url":"https://api.github.com/repos/petkaantonov/bluebird/deployments","created_at":"2013-09-07T19:39:57Z","updated_at":"2016-08-12T18:07:06Z","pushed_at":"2016-08-11T23:34:43Z","git_url":"git://github.com/petkaantonov/bluebird.git","ssh_url":"git@github.com:petkaantonov/bluebird.git","clone_url":"https://github.com/petkaantonov/bluebird.git","svn_url":"https://github.com/petkaantonov/bluebird","homepage":"http://bluebirdjs.com","size":15827,"stargazers_count":11939,"watchers_count":11939,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1433,"mirror_url":null,"open_issues_count":83,"forks":1433,"open_issues":83,"watchers":11939,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/petkaantonov/bluebird/pulls/1196"},"html":{"href":"https://github.com/petkaantonov/bluebird/pull/1196"},"issue":{"href":"https://api.github.com/repos/petkaantonov/bluebird/issues/1196"},"comments":{"href":"https://api.github.com/repos/petkaantonov/bluebird/issues/1196/comments"},"review_comments":{"href":"https://api.github.com/repos/petkaantonov/bluebird/pulls/1196/comments"},"review_comment":{"href":"https://api.github.com/repos/petkaantonov/bluebird/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/petkaantonov/bluebird/pulls/1196/commits"},"statuses":{"href":"https://api.github.com/repos/petkaantonov/bluebird/statuses/7586d62ce779424bd2570d35b1344cf2a8f4823f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":73,"deletions":75,"changed_files":3}}
{"actor":{"display_login":"ben-page"}}