-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(az): catch HttpResponseError in _check_hns #487
fix(az): catch HttpResponseError in _check_hns #487
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #487 +/- ##
========================================
- Coverage 94.4% 93.2% -1.3%
========================================
Files 23 23
Lines 1776 1776
========================================
- Hits 1678 1656 -22
- Misses 98 120 +22
|
cloudpathlib/azure/azblobclient.py
Outdated
@@ -202,7 +202,7 @@ def _check_hns(self, cloud_path: AzureBlobPath) -> Optional[bool]: | |||
try: | |||
account_info = self.service_client.get_account_information() # type: ignore | |||
self._hns_enabled = account_info.get("is_hns_enabled", False) # type: ignore | |||
except ResourceNotFoundError: | |||
except (ResourceNotFoundError, HttpResponseError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the stack trace in #486, can we confirm the error code is ErrorCode:AuthorizationPermissionMismatch
and if not, re-raise the HttpResponseError
? That will make other potential errors easier to track down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is checking for HTTPStatus.FORBIDDEN
sufficient?
01e4eea
to
a957e16
Compare
* fix(az): catch HttpResponseError in _check_hns (#487) * fix(az): catch HttpResponseError in _check_hns * chore: update HISTORY.md * format * cast fallback * review comment --------- Co-authored-by: Jakub Kubík <[email protected]>
* fix(az): catch HttpResponseError in _check_hns (drivendataorg#487) * fix(az): catch HttpResponseError in _check_hns * chore: update HISTORY.md * format * cast fallback * review comment --------- Co-authored-by: Jakub Kubík <[email protected]>
Fixed an uncaught exception in
check_hns
, which can fail with theHttpResponseError
when supplied with aDefaultAzureCredential
.Closes #486.