Running this program (with node test.mjs
):
// test.mjs
import pMinDelay from "p-min-delay";
pMinDelay(
new Promise((_, reject) => {
// Reject the promise _before_ the min delay.
// If you reject _after_ the min delay (with a value greater than 200), then the program will not crash.
setTimeout(reject, 100)
}),
200
).catch(() => {});
crashes with this log output:
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "undefined".] {
code: 'ERR_UNHANDLED_REJECTION'
}
The promise rejection should not go unhandled and the program should not crash, because there is a .catch()
after the pMinDelay
call.
This bug was likely introduced in this PR: #23
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too