Currently, errors do not include details. In an exception log you would read something of the sort:
cs.client.CloudStackApiException: HTTP 530 response from CloudStack
While if same error caused during a CloudMonkey call, you would find additionally the error code and message:
Error: (HTTP 530, error code 4250) Internal error executing command, please contact your system administrator
UPDATE. After a closer look, it seems that there might be a bug or not used feature in cs - a flag to use json as it seems - regarding JSON parsing of the Response.
Currently, response.json() could provide for example the following data if there is an error:
.{'listtemplatesresponse': {'cserrorcode': 9999,
'errorcode': 431,
'errortext': 'Unable to execute API command '
'listtemplates due to missing '
'parameter templatefilter',
'uuidList': []}}
In a test hack I've tried to change original code of [cs/client.py](https://github.com/exoscale/cs/blob/e8784588b3040750119f68eef5cd1ba3b602b4d2/cs/client.py#L352):
if response.status_code != 200:
raise CloudStackApiException(
"HTTP {0} response from CloudStack".format(
response.status_code),
error=data,
response=response)
E cs.client.CloudStackApiException: HTTP 431 response from CloudStack.
E cserrorcode 9999: Unable to execute API command listtemplates due to missing parameter templatefilter
This hack does not follow the original logic though, because the method signature in this context containes the boolean function argument json, and the code in question is for the case "it's not json" as it seems.
For time being, ambigous error messages containing just HTTP error code are really a headache. Who knows what should be behind a 431 in terms which parameter exactly is missing, or which backend problem is a HTTP 530?
Currently, errors do not include details. In an exception log you would read something of the sort:
cs.client.CloudStackApiException: HTTP 530 response from CloudStack
While if same error caused during a CloudMonkey call, you would find additionally the error code and message:
Error: (HTTP 530, error code 4250) Internal error executing command, please contact your system administrator
UPDATE. After a closer look, it seems that there might be a bug or not used feature in
cs
- a flag to use json as it seems - regarding JSON parsing of the Response.Currently,
response.json()
could provide for example the following data if there is an error:In a test hack I've tried to change original code of
[cs/client.py](https://github.com/exoscale/cs/blob/e8784588b3040750119f68eef5cd1ba3b602b4d2/cs/client.py#L352)
:as the following:
This results in a more detailed output.
This hack does not follow the original logic though, because the method signature in this context containes the boolean function argument json, and the code in question is for the case "it's not json" as it seems.
For time being, ambigous error messages containing just HTTP error code are really a headache. Who knows what should be behind a 431 in terms which parameter exactly is missing, or which backend problem is a HTTP 530?