From 72da3597e4a00614d49dbec121fce496ebb8c23d Mon Sep 17 00:00:00 2001 From: Haiwei Xu Date: Wed, 22 Jul 2015 10:52:33 +0900 Subject: [PATCH] Parse exception from SDK Some exceptions from SDK are not in stardard json format, this patch parse it to json. Change-Id: If39704f24b084cd1f6aaccd3c951636a53f3ddc1 Partial-Bug: #1472557 --- senlinclient/common/exc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/senlinclient/common/exc.py b/senlinclient/common/exc.py index 1ddf69d9..bde6a269 100644 --- a/senlinclient/common/exc.py +++ b/senlinclient/common/exc.py @@ -231,7 +231,12 @@ def parse_exception(exc): :param details: details of the exception. ''' if isinstance(exc, sdkexc.HttpException): - record = jsonutils.loads(exc.details) + record = { + 'error': { + 'code': exc.status_code, + 'message': exc.details, + } + } elif isinstance(exc, reqexc.RequestException): # Exceptions that are not captured by SDK code = exc.message[1].errno