{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/60841504","id":60841504,"diff_hunk":"@@ -0,0 +1,37 @@\n+'use strict';\n+\n+const common = require('../common');\n+const assert = require('assert');\n+const spawn = require('child_process').spawn;\n+const node = process.execPath;\n+\n+if (process.argv[2] === 'child') {\n+  const rejectPromise = () => {\n+    return new Promise((resolve, reject) => {\n+      setTimeout(reject(new Error('Reject Promise')), 100);\n+    });\n+  };\n+  rejectPromise();\n+} else {\n+  run('--trace-unhandled-rejection');\n+}\n+\n+function run(flags) {\n+  const args = [__filename, 'child'];\n+  if (flags)\n+    args.unshift(flags);\n+\n+  const child = spawn(node, args);\n+  let errorMessage = '';\n+  child.stderr.on('data', (data) => {\n+    errorMessage += data;\n+  });\n+  child.stderr.on('end', common.mustCall(() => {\n+    assert(errorMessage.match(/Reject Promise/));\n+  }));\n+  child.on('exit', common.mustCall((code) => {\n+    assert(code === 0);","path":"test/parallel/test-trace-default-error-unhandled-rejections.js","position":null,"original_position":33,"commit_id":"580ca386c3df1d2a46ef4366b4f3001c40b8e888","original_commit_id":"bedb1aa80e036cebab3a4a8a087eb9940f18301c","user":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"body":"👍 ","created_at":"2016-04-24T09:09:36Z","updated_at":"2016-04-24T09:09:36Z","html_url":"https://github.com/nodejs/node/pull/6355#discussion_r60841504","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/6355","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/60841504"},"html":{"href":"https://github.com/nodejs/node/pull/6355#discussion_r60841504"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/6355"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/6355","id":67602177,"html_url":"https://github.com/nodejs/node/pull/6355","diff_url":"https://github.com/nodejs/node/pull/6355.diff","patch_url":"https://github.com/nodejs/node/pull/6355.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/6355","number":6355,"state":"open","locked":false,"title":"promise: Add --throw-unhandled-rejection and --trace-unhandled-rejection ","user":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"body":"<!--\r\nThank you for submitting a pull request to Node.js. Before you submit, please\r\nreview below requirements and walk through the checklist. You can 'tick'\r\na box by using the letter \"x\": [x].\r\n\r\nRun the test suite by invoking: `make -j4 lint test` on linux or\r\n`vcbuild test nosign` on Windows.\r\n\r\nIf this aims to fix a regression or you’re adding a feature, make sure you also\r\nwrite a test. Finally – if possible – a benchmark that quantifies your changes.\r\n\r\nFinally, read through our contributors guide and make adjustments as necessary:\r\nhttps://github.com/nodejs/node/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n##### Checklist\r\n\r\n<!-- remove lines that do not apply to you -->\r\n\r\n- [x] tests and code linting passes\r\n- [ ] a test and/or benchmark is included\r\n- [x] documentation is changed or added\r\n- [x] the commit message follows commit guidelines\r\n\r\n\r\n##### Affected core subsystem(s)\r\n\r\n<!-- provide affected core subsystem(s) (like doc, cluster, crypto, etc) -->\r\npromise\r\n\r\n##### Description of change\r\n\r\n<!-- provide a description of the change below this comment -->\r\n\r\nWe are writing a lots of Promise modules and test these modules in our development environment. When `process.on('unhandledRejection')` error is occurred, default node behavior does not send any message, no warnings, no exceptions.  So we have to prepare the following code and add tests.\r\n\r\n```js\r\nprocess.on('unhandledRejection', (reason) => {\r\n  throw reason;\r\n});\r\n```\r\n\r\nThis is not so easy for Promise / Node beginner. So I would like to propose the following 2 options.\r\n\r\n1. `--throw-unhandled-rejection` option will throw Exception when no unhandledRejection listener\r\n2. `--trace-unhandled-rejection` option will output stderr when no unhandledRejection listener\r\n\r\nI know the default unhandledRejection behavior is discussing here\r\nhttps://github.com/nodejs/promises/issues/26\r\n\r\nBut I would like to add these options to help our developments.\r\n","created_at":"2016-04-23T09:49:50Z","updated_at":"2016-04-24T09:09:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76d7fd749b20fe08e3439d75ee0d6c2bc54a39fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/6355/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/6355/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/6355/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/580ca386c3df1d2a46ef4366b4f3001c40b8e888","head":{"label":"yosuke-furukawa:feature/promise/throw-error-unhandled-rejection","ref":"feature/promise/throw-error-unhandled-rejection","sha":"580ca386c3df1d2a46ef4366b4f3001c40b8e888","user":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"repo":{"id":45986793,"name":"node","full_name":"yosuke-furukawa/node","owner":{"login":"yosuke-furukawa","id":555645,"avatar_url":"https://avatars.githubusercontent.com/u/555645?v=3","gravatar_id":"","url":"https://api.github.com/users/yosuke-furukawa","html_url":"https://github.com/yosuke-furukawa","followers_url":"https://api.github.com/users/yosuke-furukawa/followers","following_url":"https://api.github.com/users/yosuke-furukawa/following{/other_user}","gists_url":"https://api.github.com/users/yosuke-furukawa/gists{/gist_id}","starred_url":"https://api.github.com/users/yosuke-furukawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yosuke-furukawa/subscriptions","organizations_url":"https://api.github.com/users/yosuke-furukawa/orgs","repos_url":"https://api.github.com/users/yosuke-furukawa/repos","events_url":"https://api.github.com/users/yosuke-furukawa/events{/privacy}","received_events_url":"https://api.github.com/users/yosuke-furukawa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yosuke-furukawa/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/yosuke-furukawa/node","forks_url":"https://api.github.com/repos/yosuke-furukawa/node/forks","keys_url":"https://api.github.com/repos/yosuke-furukawa/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yosuke-furukawa/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yosuke-furukawa/node/teams","hooks_url":"https://api.github.com/repos/yosuke-furukawa/node/hooks","issue_events_url":"https://api.github.com/repos/yosuke-furukawa/node/issues/events{/number}","events_url":"https://api.github.com/repos/yosuke-furukawa/node/events","assignees_url":"https://api.github.com/repos/yosuke-furukawa/node/assignees{/user}","branches_url":"https://api.github.com/repos/yosuke-furukawa/node/branches{/branch}","tags_url":"https://api.github.com/repos/yosuke-furukawa/node/tags","blobs_url":"https://api.github.com/repos/yosuke-furukawa/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yosuke-furukawa/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yosuke-furukawa/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/yosuke-furukawa/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yosuke-furukawa/node/statuses/{sha}","languages_url":"https://api.github.com/repos/yosuke-furukawa/node/languages","stargazers_url":"https://api.github.com/repos/yosuke-furukawa/node/stargazers","contributors_url":"https://api.github.com/repos/yosuke-furukawa/node/contributors","subscribers_url":"https://api.github.com/repos/yosuke-furukawa/node/subscribers","subscription_url":"https://api.github.com/repos/yosuke-furukawa/node/subscription","commits_url":"https://api.github.com/repos/yosuke-furukawa/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/yosuke-furukawa/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/yosuke-furukawa/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/yosuke-furukawa/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/yosuke-furukawa/node/contents/{+path}","compare_url":"https://api.github.com/repos/yosuke-furukawa/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yosuke-furukawa/node/merges","archive_url":"https://api.github.com/repos/yosuke-furukawa/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yosuke-furukawa/node/downloads","issues_url":"https://api.github.com/repos/yosuke-furukawa/node/issues{/number}","pulls_url":"https://api.github.com/repos/yosuke-furukawa/node/pulls{/number}","milestones_url":"https://api.github.com/repos/yosuke-furukawa/node/milestones{/number}","notifications_url":"https://api.github.com/repos/yosuke-furukawa/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yosuke-furukawa/node/labels{/name}","releases_url":"https://api.github.com/repos/yosuke-furukawa/node/releases{/id}","deployments_url":"https://api.github.com/repos/yosuke-furukawa/node/deployments","created_at":"2015-11-11T14:32:32Z","updated_at":"2015-11-11T14:32:53Z","pushed_at":"2016-04-24T09:08:15Z","git_url":"git://github.com/yosuke-furukawa/node.git","ssh_url":"git@github.com:yosuke-furukawa/node.git","clone_url":"https://github.com/yosuke-furukawa/node.git","svn_url":"https://github.com/yosuke-furukawa/node","homepage":"https://nodejs.org","size":180827,"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":"nodejs:master","ref":"master","sha":"f1294f5bfd7f02bce8029818be9c92de59749137","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}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-04-24T07:57:53Z","pushed_at":"2016-04-24T09:08:16Z","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":246724,"stargazers_count":22343,"watchers_count":22343,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3065,"mirror_url":null,"open_issues_count":663,"forks":3065,"open_issues":663,"watchers":22343,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/6355"},"html":{"href":"https://github.com/nodejs/node/pull/6355"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/6355"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/6355/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/6355/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/6355/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/580ca386c3df1d2a46ef4366b4f3001c40b8e888"}}}}