{"action":"created","issue":{"url":"https://api.github.com/repos/zloirock/core-js/issues/72","labels_url":"https://api.github.com/repos/zloirock/core-js/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/zloirock/core-js/issues/72/comments","events_url":"https://api.github.com/repos/zloirock/core-js/issues/72/events","html_url":"https://github.com/zloirock/core-js/issues/72","id":80742706,"number":72,"title":"Remove unhandled promise rejection code.","user":{"login":"Zoltu","id":886059,"avatar_url":"https://avatars.githubusercontent.com/u/886059?v=3","gravatar_id":"","url":"https://api.github.com/users/Zoltu","html_url":"https://github.com/Zoltu","followers_url":"https://api.github.com/users/Zoltu/followers","following_url":"https://api.github.com/users/Zoltu/following{/other_user}","gists_url":"https://api.github.com/users/Zoltu/gists{/gist_id}","starred_url":"https://api.github.com/users/Zoltu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zoltu/subscriptions","organizations_url":"https://api.github.com/users/Zoltu/orgs","repos_url":"https://api.github.com/users/Zoltu/repos","events_url":"https://api.github.com/users/Zoltu/events{/privacy}","received_events_url":"https://api.github.com/users/Zoltu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zloirock/core-js/labels/invalid","name":"invalid","color":"e6e6e6"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-26T01:58:23Z","updated_at":"2015-05-26T02:22:55Z","closed_at":null,"body":"https://github.com/zloirock/core-js/blob/master/modules/es6.promise.js#L100-L106\r\n\r\nThe Promise spec doesn't have this for a good reason, please remove it or at least make it easy to globally disable. There is discussion about what to do about this situation https://github.com/promises-aplus/unhandled-rejections-spec/issues but it isn't getting much traction because without a finalizer you can't be sure when someone is done with a promise.\r\n\r\nMost of the proposed solutions assume that you are using promises in a very particular way and while it is not terribly uncommon, the promise spec was intentionally written to make promises more generalized than that.\r\n\r\nThe use cases where this \"feature\" falls apart is when you have fulfilled promises that are saved and used later. A simple example is this:\r\n```\r\nlet foo = Promise.reject(new Error(\"failure\"));\r\nsetTimeout(() => foo.then(_ => console.log(\"success\"), _ => console.log(\"failure\")), 1);\r\n```\r\nIn this example, `foo` will be seen as having failed without any rejection handler and an error will be logged. However, you can see that the promise was checked for success/failure at a later time (possibly much later). If you use promises in this way right now you are hammered with failure messages even though your code is working perfectly fine.\r\n\r\nThe `unhandled promise rejection` logic, as currently implemented, discourages people from writing code that treats promises as a first-class citizens and instead delegates them to callback aggregators/transformers. A promise is an object that may have a useful lifetime that far exceeds the the executor. They are intended to store the result of the executor (success or failure) until they are garbage collected.\r\n\r\nA more concrete example would be pre-fetching some web resources that you expect you'll need later.  A rejection is a reasonable (and intended) state for a promise to be in and you may not attach a `then` to the promise until much later in your application when you need the data.  At that point it would be appropriate to check for an error, you just happened to have prefetched the data to improve the responsiveness of your application."},"comment":{"url":"https://api.github.com/repos/zloirock/core-js/issues/comments/105362899","html_url":"https://github.com/zloirock/core-js/issues/72#issuecomment-105362899","issue_url":"https://api.github.com/repos/zloirock/core-js/issues/72","id":105362899,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T02:22:55Z","updated_at":"2015-05-26T02:22:55Z","body":"> io.js promise and native chromium aren't behaving to spec then I don't believe.\r\n\r\nThis is incorrect. Following the spec does not mean you cannot add additional behaviour and semantics."}}