in src/exception_handlers.py [0:0]
def _handle_unsupported_file_exception(self, exception: UnsupportedFileException, request_route: str, request_token: str):
"""Handle the action to be taken in case we encounter a file which is not supported by Lambda's core functionality."""
LOG.debug("File is not supported for determining and redacting pii data.")
if UNSUPPORTED_FILE_HANDLING == UNSUPPORTED_FILE_HANDLING_VALID_VALUES.PASS:
LOG.debug("Unsupported file handling strategy is set to PASS. Responding back with the file content to the caller")
self.s3_client.respond_back_with_data(exception.file_content, exception.http_headers, request_route, request_token)
elif UNSUPPORTED_FILE_HANDLING == UNSUPPORTED_FILE_HANDLING_VALID_VALUES.FAIL:
LOG.debug(
f"Unsupported file handling strategy is set to FAIL. Responding back with error: "
f"{S3_ERROR_CODES.UnexpectedContent.name} to the caller")
self.s3_client.respond_back_with_error(S3_STATUS_CODES.BAD_REQUEST_400,
S3_ERROR_CODES.UnexpectedContent,
"Unsupported file encountered for determining Pii", request_route, request_token)
else:
raise Exception("Unknown exception handling strategy found for UnsupportedFileException.")