Skip to content

Instantly share code, notes, and snippets.

@idandagan1
Last active July 16, 2021 06:07
Show Gist options
  • Save idandagan1/130f63145ae327891d7362337dcc96ad to your computer and use it in GitHub Desktop.
Save idandagan1/130f63145ae327891d7362337dcc96ad to your computer and use it in GitHub Desktop.
function unhandledRejection(promise, reason) {
...
const emit = (reason, promise, promiseInfo) => {
try {
...
return process.emit('unhandledRejection', reason, promise);
} finally {
popAsyncContext(asyncId);
}
};
maybeUnhandledPromises.set(promise, {
reason,
uid: ++lastPromiseId,
warned: false,
domain: process.domain,
emit
});
...
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment