Skip to content

Commit

Permalink
Remove uncalled function.
Browse files Browse the repository at this point in the history
  • Loading branch information
aemous committed Nov 5, 2024
1 parent 532ad34 commit 8646ce4
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions awscli/botocore/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,37 +114,6 @@ def escape_xml_payload(params, **kwargs):
params['body'] = body


def check_for_200_error(response, **kwargs):
"""This function has been deprecated, but is kept for backwards compatibility."""
# From: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html
# There are two opportunities for a copy request to return an error. One
# can occur when Amazon S3 receives the copy request and the other can
# occur while Amazon S3 is copying the files. If the error occurs before
# the copy operation starts, you receive a standard Amazon S3 error. If the
# error occurs during the copy operation, the error response is embedded in
# the 200 OK response. This means that a 200 OK response can contain either
# a success or an error. Make sure to design your application to parse the
# contents of the response and handle it appropriately.
#
# So this handler checks for this case. Even though the server sends a
# 200 response, conceptually this should be handled exactly like a
# 500 response (with respect to raising exceptions, retries, etc.)
# We're connected *before* all the other retry logic handlers, so as long
# as we switch the error code to 500, we'll retry the error as expected.
if response is None:
# A None response can happen if an exception is raised while
# trying to retrieve the response. See Endpoint._get_response().
return
http_response, parsed = response
if _looks_like_special_case_error(
http_response.status_code, http_response.content
):
logger.debug("Error found for response with 200 status code, "
"errors: %s, changing status code to "
"500.", parsed)
http_response.status_code = 500


def _looks_like_special_case_error(status_code, body):
if status_code == 200 and body:
try:
Expand Down

0 comments on commit 8646ce4

Please sign in to comment.