From f4987456dbff4ce8ea09b33cc7151aac8639028a Mon Sep 17 00:00:00 2001 From: Sylvain Bauza Date: Fri, 24 Jan 2014 15:41:57 +0100 Subject: [PATCH] Fix exception rendering for client Exceptions from the API were not properly catched. Change-Id: Ib1db84a0a8b56f1135ea9d73c688b55d18fa683a Closes-Bug: #1272352 --- climateclient/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/climateclient/base.py b/climateclient/base.py index 0bb0c14..7665e85 100644 --- a/climateclient/base.py +++ b/climateclient/base.py @@ -19,6 +19,7 @@ import json import requests from climateclient import exception +from climateclient.openstack.common.gettextutils import _ # noqa class BaseClientManager(object): @@ -124,7 +125,7 @@ class BaseClientManager(object): body = None if resp.status_code >= 400: - raise exception.ClimateClientException(resp.body, - code=resp.status_code) + body = _("ERROR: {0}").format(body.get('error_message', body)) + raise exception.ClimateClientException(body, code=resp.status_code) return resp, body