{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/42396570","id":42396570,"diff_hunk":"@@ -137,13 +137,29 @@ Here is an example that logs every unhandled rejection to the console\n         // application specific logging, throwing an error, or other logic here\n     });\n \n-For example, here is a rejection that will trigger the `'unhandledRejection'`\n+For example, here is a rejection that will trigger the 'unhandledRejection'\n event:\n \n     somePromise.then(function(res) {\n       return reportToUser(JSON.pasre(res)); // note the typo\n     }); // no `.catch` or `.then`\n \n+Here is an example of a coding pattern that will also trigger\n+'unhandledRejection':\n+\n+    function SomeResource() {\n+      // Initially set the loaded status to a rejected promise\n+      this.loaded = Promise.reject(new Error('Resource not yet loaded!'));\n+    }\n+\n+    var resource = new SomeResource();\n+    // no .catch or .then on resource.loaded for at least a turn\n+\n+To deal with cases like this, which are likely false positives, you can either","path":"doc/api/process.markdown","position":23,"original_position":23,"commit_id":"90103220aaa88d8215f7f67bba3e2248a0c32214","original_commit_id":"90103220aaa88d8215f7f67bba3e2248a0c32214","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},"body":"@Fishrock123 the biggest point for unhandled rejection hooks is to un-silence developer errors (but not bug you too much about platform errors). So a developer error like:\r\n\r\n```js\r\nJSON.prase('\"note it's prase and not parse\");\r\n```\r\n\r\nDon't get turned into a silent rejection but are somehow obtainable. On the other hand - program errors (like a network stream not opening) might (this is an opinion) be silenced since if you did not `.catch` them you might not care about handling the error (like calling a node method without a callback arg, or ignoring `err`).\r\n","created_at":"2015-10-19T16:56:29Z","updated_at":"2015-10-19T16:56:29Z","html_url":"https://github.com/nodejs/node/pull/979#discussion_r42396570","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/979","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/42396570"},"html":{"href":"https://github.com/nodejs/node/pull/979#discussion_r42396570"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/979"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/979","id":30127164,"html_url":"https://github.com/nodejs/node/pull/979","diff_url":"https://github.com/nodejs/node/pull/979.diff","patch_url":"https://github.com/nodejs/node/pull/979.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/979","number":979,"state":"open","locked":false,"title":"doc: more use-cases for promise events","user":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"body":"This adds an example of a semi-common promise pattern that could\r\nresult in false-positive 'unhandledRejection' events, to help motivate\r\nwhy there is a dual 'rejectionHandled' event. I anticipate it being\r\nhelpful to users who encounter 'unhandledRejection' events that do not\r\nstem from obvious typos such as the JSON.pasre example.","created_at":"2015-02-26T23:17:48Z","updated_at":"2015-10-19T16:56:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f82796ea406e63645162768291887da1e59ac23c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/979/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/979/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/979/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/90103220aaa88d8215f7f67bba3e2248a0c32214","head":{"label":"domenic:extended-promise-examples","ref":"extended-promise-examples","sha":"90103220aaa88d8215f7f67bba3e2248a0c32214","user":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"repo":{"id":30843579,"name":"io.js","full_name":"domenic/io.js","owner":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/domenic/io.js","description":"A friendly fork of Node.js with an open governance model","fork":true,"url":"https://api.github.com/repos/domenic/io.js","forks_url":"https://api.github.com/repos/domenic/io.js/forks","keys_url":"https://api.github.com/repos/domenic/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/domenic/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/domenic/io.js/teams","hooks_url":"https://api.github.com/repos/domenic/io.js/hooks","issue_events_url":"https://api.github.com/repos/domenic/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/domenic/io.js/events","assignees_url":"https://api.github.com/repos/domenic/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/domenic/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/domenic/io.js/tags","blobs_url":"https://api.github.com/repos/domenic/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/domenic/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/domenic/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/domenic/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/domenic/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/domenic/io.js/languages","stargazers_url":"https://api.github.com/repos/domenic/io.js/stargazers","contributors_url":"https://api.github.com/repos/domenic/io.js/contributors","subscribers_url":"https://api.github.com/repos/domenic/io.js/subscribers","subscription_url":"https://api.github.com/repos/domenic/io.js/subscription","commits_url":"https://api.github.com/repos/domenic/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/domenic/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/domenic/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/domenic/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/domenic/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/domenic/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/domenic/io.js/merges","archive_url":"https://api.github.com/repos/domenic/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/domenic/io.js/downloads","issues_url":"https://api.github.com/repos/domenic/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/domenic/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/domenic/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/domenic/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/domenic/io.js/labels{/name}","releases_url":"https://api.github.com/repos/domenic/io.js/releases{/id}","created_at":"2015-02-15T21:50:44Z","updated_at":"2015-06-11T13:42:01Z","pushed_at":"2015-06-10T20:29:32Z","git_url":"git://github.com/domenic/io.js.git","ssh_url":"git@github.com:domenic/io.js.git","clone_url":"https://github.com/domenic/io.js.git","svn_url":"https://github.com/domenic/io.js","homepage":"https://iojs.org","size":132139,"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":"v1.x"}},"base":{"label":"nodejs:v1.x","ref":"v1.x","sha":"ca8c9ec2c8ceab7c900167de6901f0acb9a13248","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-10-19T15:59:23Z","pushed_at":"2015-10-19T16:52:41Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":378526,"stargazers_count":16291,"watchers_count":16291,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1581,"mirror_url":null,"open_issues_count":536,"forks":1581,"open_issues":536,"watchers":16291,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/979"},"html":{"href":"https://github.com/nodejs/node/pull/979"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/979"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/979/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/979/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/979/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/90103220aaa88d8215f7f67bba3e2248a0c32214"}}}}