Skip to content

Commit 972e3b0

Browse files
committed
Minor fixes
1 parent 5614a78 commit 972e3b0

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

filenameprocessor/src/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131

3232
# The size in bytes of an empty batch file containing only the headers row
33-
EMPTY_BATCH_FILE_SIZE_IN_BYTES = 615
33+
EMPTY_BATCH_FILE_SIZE_IN_BYTES = 700
3434

3535

3636
class FileStatus(StrEnum):

filenameprocessor/src/file_name_processor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ def handle_record(record) -> dict:
100100
UnhandledSqsError,
101101
Exception,
102102
) as error:
103-
logger.error("Error processing file '%s': %s", file_key, str(error))
103+
if isinstance(error, EmptyFileError):
104+
# Avoid error log noise for accepted scenario in which supplier provides a batch file with no records
105+
logger.warning("Error processing file '%s': %s", file_key, str(error))
106+
else:
107+
logger.error("Error processing file '%s': %s", file_key, str(error))
104108

105109
queue_name = f"{supplier}_{vaccine_type}"
106110
file_status = get_file_status_for_error(error)

filenameprocessor/tests/test_lambda_handler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ def test_lambda_handler_correctly_flags_empty_file(self):
229229
self.assertEqual(self.get_audit_table_items(), expected_table_items)
230230
self.assert_no_sqs_message()
231231
self.assert_ack_file_contents(file_details)
232+
self.mock_logger.warning.assert_called_once_with(
233+
"Error processing file '%s': %s",
234+
"RSV_Vaccinations_v5_X8E5B_20000101T00000001.csv",
235+
"Initial file validation failed: batch file was empty"
236+
)
232237

233238
def test_lambda_handler_non_root_file(self):
234239
"""

0 commit comments

Comments
 (0)