summaryrefslogtreecommitdiff
path: root/lib/internal/process/execution.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/process/execution.js')
-rw-r--r--lib/internal/process/execution.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js
index 5712b80eaf..7b651ba5d1 100644
--- a/lib/internal/process/execution.js
+++ b/lib/internal/process/execution.js
@@ -117,7 +117,7 @@ function noop() {}
// before calling into process._fatalException, or this function should
// take extra care of the async hooks before it schedules a setImmediate.
function createFatalException() {
- return (er) => {
+ return (er, fromPromise) => {
// It's possible that defaultTriggerAsyncId was set for a constructor
// call that threw and was never cleared. So clear it now.
clearDefaultTriggerAsyncId();
@@ -138,9 +138,10 @@ function createFatalException() {
} catch {} // Ignore the exception. Diagnostic reporting is unavailable.
}
+ const type = fromPromise ? 'unhandledRejection' : 'uncaughtException';
if (exceptionHandlerState.captureFn !== null) {
exceptionHandlerState.captureFn(er);
- } else if (!process.emit('uncaughtException', er)) {
+ } else if (!process.emit('uncaughtException', er, type)) {
// If someone handled it, then great. otherwise, die in C++ land
// since that means that we'll exit the process, emit the 'exit' event.
try {