in src/clients/s3_client.py [0:0]
def respond_back_with_error(self, status_code: S3_STATUS_CODES, error_code: S3_ERROR_CODES, error_message: str,
request_route: str, request_token: str):
"""Call S3's WriteGetObjectResponse API to return an error to the original caller of get_object API."""
start_time = time.time()
try:
self.s3.write_get_object_response(StatusCode=status_code.get_http_status_code(), ErrorCode=error_code.name,
ErrorMessage=error_message,
RequestRoute=request_route, RequestToken=request_token)
except Exception as error:
LOG.error("Error occurred while calling s3 write get object response with error.", exc_info=True)
self.write_get_object_metrics.add_fault_count()
raise error
finally:
self.write_get_object_metrics.add_latency(start_time, time.time())