Skip to content

Commit

Permalink
Wrap reason with unsafeToString() if it's a string
Browse files Browse the repository at this point in the history
  • Loading branch information
MadaraUchiha committed Nov 20, 2017
1 parent ba4adc5 commit ab45e60
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/internal/process/promises.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const { safeToString } = process.binding('util');

const promiseRejectEvent = process._promiseRejectEvent;
const hasBeenNotifiedProperty = new WeakMap();
const promiseToGuidProperty = new WeakMap();
Expand Down Expand Up @@ -62,7 +64,9 @@ function setupPromises(scheduleMicrotasks) {
if (reason instanceof Error) {
process.emitWarning(reason.stack, 'UnhandledPromiseRejectionWarning');
} else {
process.emitWarning(reason, 'UnhandledPromiseRejectionWarning');
process.emitWarning(
safeToString(reason), 'UnhandledPromiseRejectionWarning'
);
}
} catch (e) {
// ignored
Expand Down

0 comments on commit ab45e60

Please sign in to comment.