Commit 5ed59e1e authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

RAPI client: Handle urllib2.HTTPError and raise GanetiApiError

This allows users of the RAPI client to catch GanetiApiError for all HTTP
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent e8ebbd2b
......@@ -419,6 +419,8 @@ class GanetiRapiClient(object):
encoded_response_content =
except (OpenSSL.SSL.Error, OpenSSL.crypto.Error), err:
raise CertificateError("SSL issue: %s (%r)" % (err, err))
except urllib2.HTTPError, err:
raise GanetiApiError(str(err), code=err.code)
if encoded_response_content:
response_content = simplejson.loads(encoded_response_content)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment