Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[squash] address comments
  • Loading branch information
BridgeAR committed Sep 26, 2017
commit 5d2c83e916b0f550de4cab04f09636f4cf442707
9 changes: 9 additions & 0 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ Type: End-of-Life
`Intl.v8BreakIterator` was a non-standard extension and has been removed.
See [`Intl.Segmenter`](https://github.com/tc39/proposal-intl-segmenter).

<a id="DEP0018"></a>
### DEP0018: Unhandled promise rejections

Type: End-of-Life

Any unhandled promise rejection that is garbage collected is going to exit the
process similar to unhandled exceptions. Please make sure to always handle all
possible rejections.

<a id="DEP0019"></a>
### DEP0019: require('.') resolved outside directory

Expand Down
11 changes: 6 additions & 5 deletions test/message/promise_fast_handled_reject.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
'use strict';

const common = require('../common');
const assert = require('assert');

const p1 = new Promise((res, rej) => {
consol.log('One'); // eslint-disable-line no-undef
throw new Error('One');
});

const p2 = new Promise((res, rej) => { // eslint-disable-line no-unused-vars
consol.log('Two'); // eslint-disable-line no-undef
new Promise((res, rej) => {
throw new Error('Two');
});

const p3 = new Promise((res, rej) => {
consol.log('Three'); // eslint-disable-line no-undef
throw new Error('Three');
});

new Promise((res, rej) => {
process.nextTick(() => {
setTimeout(common.mustCall(() => {
p1.catch(() => {});
p3.catch(() => {});
Expand Down
10 changes: 5 additions & 5 deletions test/message/promise_fast_handled_reject.out
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(node:30929) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: consol is not defined
(node:30929) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ReferenceError: consol is not defined
(node:30929) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): ReferenceError: consol is not defined
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): One
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Two
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Three
exit event emitted
*test*message*promise_fast_handled_reject.js:*
consol.log('Two'); // eslint-disable-line no-undef
throw new Error('Two');
^

ReferenceError: consol is not defined
Error: Two
at *test*message*promise_fast_handled_reject.js:*:*
at Promise (<anonymous>)
at Object.<anonymous> (*test*message*promise_fast_handled_reject.js:*:*)
Expand Down
5 changes: 3 additions & 2 deletions test/message/promise_fast_reject.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
'use strict';

// We should always have the stacktrace of the oldest rejection.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is behavior we can rely on - if V8 decides to GC 'Two' first that's entirely in its right.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I somewhat agree. It seems like we can rely on it for now though. Would you still want this to be changed?

// Theoretically the GC could handle this differently.

require('../common');
const assert = require('assert');

new Promise(function(res, rej) {
consol.log('One'); // eslint-disable-line no-undef
throw new Error('One');
});

new Promise(function(res, rej) {
consol.log('Two'); // eslint-disable-line no-undef
throw new Error('Two');
});

process.on('uncaughtException', (err) =>
Expand Down
8 changes: 4 additions & 4 deletions test/message/promise_fast_reject.out
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(node:30479) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: consol is not defined
(node:30479) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ReferenceError: consol is not defined
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): ReferenceError: One
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): ReferenceError: Two
exit event emitted
*test*message*promise_fast_reject.js:*
consol.log('One'); // eslint-disable-line no-undef
throw new Error('One');
^

ReferenceError: consol is not defined
Error: One
at *test*message*promise_fast_reject.js:*:*
at Promise (<anonymous>)
at Object.<anonymous> (*test*message*promise_fast_reject.js:*:*)
Expand Down
2 changes: 1 addition & 1 deletion test/message/promise_reject.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(node:30196) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: oops
(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: oops
exit event emitted
*test*message*promise_reject.js:*
Promise.reject(new Error('oops'));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-promises-gc-before-handled.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const common = require('../common');

const p = new Promise((res, rej) => {
consol.log('oops'); // eslint-disable-line no-undef
throw new Error('oops');
});

// Manually call GC due to possible memory constraints with attempting to
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-promises-handled-reject.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const common = require('../common');

const p = new Promise((res, rej) => {
consol.log('oops'); // eslint-disable-line no-undef
throw new Error('oops');
});

// Manually call GC due to possible memory constraints with attempting to
Expand Down