Skip to content

Ethanann/migrate msrest to azurecore - #21

Open
Ethan Ann (ethanann-ms) wants to merge 2 commits into
mainfrom
ethanann/migrate-msrest-to-azurecore
Open

Ethanann/migrate msrest to azurecore#21
Ethan Ann (ethanann-ms) wants to merge 2 commits into
mainfrom
ethanann/migrate-msrest-to-azurecore

Conversation

@ethanann-ms

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double check what the Azure SDK patterns are for errors, otherwise looks good


import os
import msrest
from azure.core.exceptions import HttpResponseError

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants