-
Notifications
You must be signed in to change notification settings - Fork 517
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
fix: Handle errors thrown in user callbacks in each #869
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added logic to Version each function that catches any errors thrown in the user provided callback and calls the user provided done function with the error. If user does not provide a done function, each will return a promise that will reject with any error that occurs. Added unit tests for the Version each function.
Hunga1
commented
Jan 5, 2023
This comment was marked as outdated.
This comment was marked as outdated.
Resolved merge conflicts: - lib/base/Version.ts
childish-sambino
approved these changes
Jan 6, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some minor nits.
claudiachua
reviewed
Jan 6, 2023
Removed the unnecessary nested try, catch block and conditional test if the callback is undefined. Refactored the function code docs from jsdoc to tsdoc.
claudiachua
reviewed
Jan 6, 2023
Kudos, SonarCloud Quality Gate passed! |
claudiachua
approved these changes
Jan 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue where errors thrown in user callbacks are not bubbled up. Any errors thrown in user provided
callback
functions in theeach
function will now be caught and passed to the user provideddone
call.The
each
function will now return apromise
instead ofvoid
. The promise will resolve when all records are processed, the limit is reached, or when the user provideddone
function param is executed. The promise will reject if an error occurs in the user callback and the optional user provideddone
function param is not provided, or the user provideddone
function throws an error.Added unit tests to test functionality of the each function.