Skip to content

Commit 5614a78

Browse files
authored
VEd-745 Observability - missed a scenario (#818)
1 parent b81b753 commit 5614a78

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

filenameprocessor/src/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class FileNotProcessedReason(StrEnum):
4747
"""Reasons why a file was not processed"""
4848
EMPTY = "Empty file"
4949
UNAUTHORISED = "Unauthorised"
50-
INVALID_FILENAME = "Invalid filename"
5150

5251

5352
class AuditTableKeys(StrEnum):

filenameprocessor/src/file_name_processor.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,12 @@ def handle_record(record) -> dict:
131131

132132
def get_file_status_for_error(error: Exception) -> str:
133133
"""Creates a file status based on the type of error that was thrown"""
134-
if not isinstance(error, (VaccineTypePermissionsError, InvalidFileKeyError, EmptyFileError)):
135-
return FileStatus.FAILED
136-
137134
if isinstance(error, VaccineTypePermissionsError):
138135
return f"{FileStatus.NOT_PROCESSED} - {FileNotProcessedReason.UNAUTHORISED}"
139136
elif isinstance(error, EmptyFileError):
140137
return f"{FileStatus.NOT_PROCESSED} - {FileNotProcessedReason.EMPTY}"
141138

142-
return f"{FileStatus.NOT_PROCESSED} - {FileNotProcessedReason.INVALID_FILENAME}"
139+
return FileStatus.FAILED
143140

144141

145142
def handle_unexpected_bucket_name(bucket_name: str, file_key: str) -> dict:

filenameprocessor/tests/test_lambda_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def test_lambda_invalid_file_key_no_other_files_in_queue(self):
276276
"message_id": {"S": file_details.message_id},
277277
"filename": {"S": file_details.file_key},
278278
"queue_name": {"S": "unknown_unknown"},
279-
"status": {"S": "Not processed - Invalid filename"},
279+
"status": {"S": "Failed"},
280280
"error_details": {"S": "Initial file validation failed: invalid file key"},
281281
"timestamp": {"S": file_details.created_at_formatted_string},
282282
"expires_at": {"N": str(file_details.expires_at)},

0 commit comments

Comments
 (0)