Closed silencev closed 6 years ago
Hi @silencev It's not a CloudError (since the semantic of CloudError is server side error, not HTTP problems), but I understand your problem. Let me think about it more in details. Thanks,
This is fixed in recent generation by passing stream=False
. This ask requests to load right away the body in memory. This then will be caught way before deserialization, while still in "requests", and benefits from the retry strategy of "requests" automatically.
Example of new generated code:
https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/operations/virtual_machines_operations.py#L829
If even after the retry from "requests" there is still ConnectionError, this will be raise as a ClientRequestError from here: https://github.com/Azure/msrest-for-python/blob/12fb980c3290daa9c83bacc7e43c3f1455904b8c/msrest/service_client.py#L366-L369
I am currently using msrest 0.4.11 and found the
Deserializer
will raise this exception:requests.exceptions.ConnectionError
requests library read the raw socket to get the response body when calling
response.text
here.if connection/server is not stable, it will raise ConnectionError exception from requests library
is it possible to catch this exception in Deserializer? Because user of Azure SDK will expect the exception is always
CloudError
.here is the callstack of
msrest 0.4.11
version:thanks!