sindresorhus / p-map

Map over promises concurrently
MIT License
1.27k stars 58 forks source link

Prevent some potential unhandled exceptions #48

Closed huntharo closed 2 years ago

huntharo commented 3 years ago
sindresorhus commented 3 years ago

Thanks for catching this issue 🙏


such as a try/catch within the catch...

I think this would be best. Would you be able to add it?

huntharo commented 2 years ago

Thanks for catching this issue 🙏

such as a try/catch within the catch...

I think this would be best. Would you be able to add it?

Done. I think the only option after an iterable.next() exception is to reject the promise and stop iteration... if we catch and disregard the exception and keep going we may just get infinite iterable.next() exceptions. As a result, I chose to reject the main promise and stop iteration in case of these exceptions to avoid an infinite loop and to try to preserve what I think is the existing behavior prior to catching these exceptions.

sindresorhus commented 2 years ago

Thanks :)