Fix exception rendering for client

Exceptions from the API were not properly catched.

Change-Id: Ib1db84a0a8b56f1135ea9d73c688b55d18fa683a
Closes-Bug: #1272352
This commit is contained in:
Sylvain Bauza
2014-01-24 15:41:57 +01:00
parent 153b7ab0f3
commit f4987456db

View File

@@ -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