Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Handle empty return bodies when processing S3 errors. #32

Merged
merged 1 commit into from

2 participants

@kellymclaughlin

Currently error commands that do not return a body cause
s3cmd to output an ugly backtrace. This change checks to
see if the data field of the response is non-empty before
calling getTreeFromXml on it. An example of an offending
command is using s3cmd info on a nonexistent object.

@kellymclaughlin kellymclaughlin Handle empty return bodies when processing S3 errors.
Currently error commands that do not return a body cause
s3cmd to output an ugly backtrace. This change checks to
see if the data field of the response is non-empty before
calling `getTreeFromXml` on it. An example of an offending
command is using `s3cmd info` on a nonexistent object.
a845140
@mludvig mludvig merged commit 0151fa4 into s3tools:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 29, 2012
  1. @kellymclaughlin

    Handle empty return bodies when processing S3 errors.

    kellymclaughlin authored
    Currently error commands that do not return a body cause
    s3cmd to output an ugly backtrace. This change checks to
    see if the data field of the response is non-empty before
    calling `getTreeFromXml` on it. An example of an offending
    command is using `s3cmd info` on a nonexistent object.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  S3/Exceptions.py
View
2  S3/Exceptions.py
@@ -44,7 +44,7 @@ def __init__(self, response):
if response.has_key("headers"):
for header in response["headers"]:
debug("HttpHeader: %s: %s" % (header, response["headers"][header]))
- if response.has_key("data"):
+ if response.has_key("data") and response["data"]:
tree = getTreeFromXml(response["data"])
error_node = tree
if not error_node.tag == "Error":
Something went wrong with that request. Please try again.