-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent some potential unhandled exceptions #48
Conversation
huntharo
commented
Sep 7, 2021
•
edited
Loading
edited
- Source iterator next() functions can throw
- There are 3 distinct cases where next() is called, one of which does not have a try/catch around it that will reject the outer promise, resulting in an unhandled promise rejection
- Note: in the current state, the 3rd test fails - I'm not sure how you want to handle this... a try/catch for the entire next() function would handle it... but there are other ways, such as a try/catch within the catch...
- Source iterator next() functions can throw - There are 3 distinct cases where next() is called, one of which does not have a try/catch around it that will reject the outer promise, resulting in an unhandled promise rejection
Thanks for catching this issue 🙏
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. |
Thanks :) |