Ethanann/migrate msrest to azurecore - #21
Conversation
Carter Tinney (cartertinney)
left a comment
There was a problem hiding this comment.
Just double check what the Azure SDK patterns are for errors, otherwise looks good
|
|
||
| import os | ||
| import msrest | ||
| from azure.core.exceptions import HttpResponseError |
There was a problem hiding this comment.
Is it the standard practice in the Azure SDK to have the application consume azure.core.exceptions for error handling, or is it more conventional for the libraries to re-export the azure core errors?
The latter would probably be less brittle going forth, but obviously only do that if that's the preferred Azure SDK approach.
There was a problem hiding this comment.
Direct import from azure.core.exceptions is the standard. The Azure SDK for Python design guidelines treat azure-core as a shared, always-present dependency of every client library, and explicitly discourage libraries from re-exporting its exception types. Consumers are expected to from azure.core.exceptions import HttpResponseError etc
Regenerate azure.iot.hub.protocol with @autorest/python v6 (models-mode: msrest to preserve manager call shape; vendored _serialization.py removes runtime msrest dep).
Rewrite auth.py so ConnectionStringAuthentication and AzureIdentityCredentialAdapter derive from azure.core.pipeline.policies.
Update managers to the v6 client signature (base_url, authentication_policy=) and convert query_iot_hub's raw=True call to a cls= callback.
Drop msrest from setup.py, bump azure-core minimum to 1.29, and rename service exception docstrings and samples from HttpOperationError to HttpResponseError.
BREAKING: msrest.exceptions.HttpOperationError is now azure.core.exceptions.HttpResponseError.