{"action":"created","issue":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/856","labels_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/856/labels{/name}","comments_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/856/comments","events_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/856/events","html_url":"https://github.com/petkaantonov/bluebird/issues/856","id":115739472,"number":856,"title":"nested rejects","user":{"login":"vitaly-t","id":5108906,"avatar_url":"https://avatars.githubusercontent.com/u/5108906?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaly-t","html_url":"https://github.com/vitaly-t","followers_url":"https://api.github.com/users/vitaly-t/followers","following_url":"https://api.github.com/users/vitaly-t/following{/other_user}","gists_url":"https://api.github.com/users/vitaly-t/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaly-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaly-t/subscriptions","organizations_url":"https://api.github.com/users/vitaly-t/orgs","repos_url":"https://api.github.com/users/vitaly-t/repos","events_url":"https://api.github.com/users/vitaly-t/events{/privacy}","received_events_url":"https://api.github.com/users/vitaly-t/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-08T15:24:14Z","updated_at":"2015-11-08T15:33:41Z","closed_at":null,"body":"This is just a question about something I'm trying to understand:\r\n\r\n**Why nested rejects work differently from nested resolve operations?**\r\n\r\nIf we execute a nested resolve operation like this:\r\n\r\n```javascript\r\npromise.resolve(promise.resolve(\"nested\"))\r\n    .then(function (data) {\r\n        console.log(data);\r\n    });\r\n```\r\nwe get the expected output:\r\n```\r\nnested\r\n```\r\nBut if we execute a nested reject operation:\r\n\r\n```javascript\r\npromise.reject(promise.reject(\"nested\"))\r\n    .catch(function (error) {\r\n        console.log(error);\r\n    });\r\n```\r\nthen the output is:\r\n```\r\n{ _bitField : 18087936, _fulfillmentHandler0 : 'nested', _rejectionHandler0 : undefined, _promise0 : undefined, _receiver0 : undefined }\r\n```\r\n\r\nI have looked through the [promise specification](https://promisesaplus.com/), and couldn't find any contradiction to this, hence the question.\r\n"},"comment":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/comments/154833963","html_url":"https://github.com/petkaantonov/bluebird/issues/856#issuecomment-154833963","issue_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/856","id":154833963,"user":{"login":"benjamingr","id":1315533,"avatar_url":"https://avatars.githubusercontent.com/u/1315533?v=3","gravatar_id":"","url":"https://api.github.com/users/benjamingr","html_url":"https://github.com/benjamingr","followers_url":"https://api.github.com/users/benjamingr/followers","following_url":"https://api.github.com/users/benjamingr/following{/other_user}","gists_url":"https://api.github.com/users/benjamingr/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamingr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamingr/subscriptions","organizations_url":"https://api.github.com/users/benjamingr/orgs","repos_url":"https://api.github.com/users/benjamingr/repos","events_url":"https://api.github.com/users/benjamingr/events{/privacy}","received_events_url":"https://api.github.com/users/benjamingr/received_events","type":"User","site_admin":false},"created_at":"2015-11-08T15:33:41Z","updated_at":"2015-11-08T15:33:41Z","body":"I'm not sure why you're asking support questions here again, let alone ones that have nothing to do with bluebird and apply equally as much to any other spec-conforming promise libraries.\r\n\r\nAnyway, `Promise.resolve` and `Promise.reject` are not a part of Promises/A+ (they're a part of a different spec), let's look at the ES2015 spec: [`Promise.reject`](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.reject) and [`Promise.resolve`](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.resolve) both delegate to the semantics of the resolve/reject semantics of the promise constructor (though promiseCapability).\r\n\r\nPromise Reject just [calls RejectPromise](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise-reject-functions) which just sets the rejection value of the result.\r\n\r\nPromise Resolve on the other hand [does a lot more](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise-resolve-functions), namely it checks if the return value has a `then` method and performs `Perform EnqueueJob (\"PromiseJobs\", PromiseResolveThenableJob, «‍promise, resolution, thenAction»)` which means \"recursively assimilate the promise passed in\".\r\n\r\nIn the future, please prefer asking questions in the appropriate support channels. This is not the first time I've asked you to do this - time spent answering them is time not spent on bugs. Sorry for the tone."}}