powertools-lambda-typescript
powertools-lambda-typescript copied to clipboard
feat(batch): add option to not throw `FullBatchFailureError` when the entire batch fails
Summary
Currently, when using the Batch Processor utility, if all the records in a batch are marked as failed, the utility throws a FullBatchFailureError
. However, there can be scenarios where we do not want to throw an error for this condition.
This PR adds a throwOnFullBatchFailure
option, giving users the ability to bypass the FullBatchFailureError
when the entire batch fails.
Changes
- Introduce
throwOnFullBatchFailure
option that can be passed as an option insideprocessPartialResponse
orprocessPartialResponseSync
functions - During full batch failure
- If
throwOnFullBatchFailure
is false, we will not throwFullBatchFailureError
exception - If
throwOnFullBatchFailure
is not provided or istrue
, we will keep the current implementation of throwingFullBatchFailureError
exception
- If
- Update the relevant doc blocks
- Unit tests for full batch failure for processPartialResponse
and
processPartialResponseSync` function - I believe we have to update the docs but couldn't figure it out in which section. For now, I have added a line for the option.
Issue number: #2122
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.