@@ -18,18 +18,6 @@ def validate_content_headers(csv_content_reader) -> None:
1818 raise InvalidHeaders ("File headers are invalid." )
1919
2020
21- def get_file_status_for_error (error : Exception ) -> str :
22- """Returns the appropriate file status based on the error that occurred"""
23- if isinstance (error , NoOperationPermissions ):
24- return f"{ FileStatus .NOT_PROCESSED } - { FileNotProcessedReason .UNAUTHORISED } "
25-
26- # TODO - discuss with team. Do we want client errors to leave pipeline unblocked. Or block and investigate?
27- elif isinstance (error , InvalidHeaders ):
28- return f"{ FileStatus .NOT_PROCESSED } - { FileNotProcessedReason .INVALID_FILE_HEADERS } "
29-
30- return FileStatus .FAILED
31-
32-
3321def get_permitted_operations (
3422 supplier : str , vaccine_type : str , allowed_permissions_list : list
3523) -> set :
@@ -128,7 +116,8 @@ def file_level_validation(incoming_message_body: dict) -> dict:
128116 file_key = file_key or "Unable to ascertain file_key"
129117 created_at_formatted_string = created_at_formatted_string or "Unable to ascertain created_at_formatted_string"
130118 make_and_upload_ack_file (message_id , file_key , False , False , created_at_formatted_string )
131- file_status = get_file_status_for_error (error )
119+ file_status = f"{ FileStatus .NOT_PROCESSED } - { FileNotProcessedReason .UNAUTHORISED } " \
120+ if isinstance (error , NoOperationPermissions ) else FileStatus .FAILED
132121
133122 try :
134123 move_file (SOURCE_BUCKET_NAME , file_key , f"archive/{ file_key } " )
0 commit comments