Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws_lambda_powertools/utilities/batch/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def _prepare(self):
"""
self.success_messages.clear()
self.fail_messages.clear()
self.exceptions.clear()
self.batch_response = copy.deepcopy(self.DEFAULT_RESPONSE)

def _process_record(self, record: dict) -> Union[SuccessResponse, FailureResponse]:
Expand Down
14 changes: 11 additions & 3 deletions tests/functional/test_utilities_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,16 @@ def test_batch_processor_error_when_entire_batch_fails(sqs_event_factory, record
def lambda_handler(event, context):
return processor.response()

# WHEN/THEN
# WHEN calling `lambda_handler` in cold start
with pytest.raises(BatchProcessingError) as e:
lambda_handler(event, {})
ret = str(e)
assert ret is not None

# THEN raise BatchProcessingError
assert "All records failed processing. " in str(e.value)

# WHEN calling `lambda_handler` in warm start
with pytest.raises(BatchProcessingError) as e:
lambda_handler(event, {})

# THEN raise BatchProcessingError
assert "All records failed processing. " in str(e.value)