summaryrefslogtreecommitdiff
path: root/swiftclient/shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-03-17 22:20:35 +0000
committerGerrit Code Review <review@openstack.org>2016-03-17 22:20:35 +0000
commitc4ce65f2d2ddffc1951def5be8867cd59e6b17ee (patch)
treee807be1570cc805bcbc87b9ad8761b8d6bc5c5bd /swiftclient/shell.py
parent985c03820926a16b9592c8857379741c496a880b (diff)
parent9b8ab67a780416508b995adafb07e96ea646d6f8 (diff)
downloadpython-swiftclient-c4ce65f2d2ddffc1951def5be8867cd59e6b17ee.tar.gz
Merge "Include response headers in ClientExceptions"
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-xswiftclient/shell.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index aa95c11..4ba71b4 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -33,7 +33,8 @@ from swiftclient.utils import config_true_value, generate_temp_url, prt_bytes
from swiftclient.multithreading import OutputManager
from swiftclient.exceptions import ClientException
from swiftclient import __version__ as client_version
-from swiftclient.client import logger_settings as client_logger_settings
+from swiftclient.client import logger_settings as client_logger_settings, \
+ parse_header_string
from swiftclient.service import SwiftService, SwiftError, \
SwiftUploadObject, get_conn
from swiftclient.command_helpers import print_account_stats, \
@@ -1519,7 +1520,13 @@ Examples:
parser.usage = globals()['st_%s_help' % args[0]]
try:
globals()['st_%s' % args[0]](parser, argv[1:], output)
- except (ClientException, RequestException, socket.error) as err:
+ except ClientException as err:
+ output.error(str(err))
+ trans_id = (err.http_response_headers or {}).get('X-Trans-Id')
+ if trans_id:
+ output.error("Failed Transaction ID: %s",
+ parse_header_string(trans_id))
+ except (RequestException, socket.error) as err:
output.error(str(err))
if output.get_error_count() > 0: