drivendataorg / drivendataorg/cloudpathlib
Wrap exceptions from cloud SDKs
- Dominant language
- Python
- Stars
- 628
- Forks
- 88
- Avg merge
- 17h 28m
- Merged PRs (30d)
- 2
Description
The current implementation does not intercept exceptions thrown by the various underlying cloud apis. As a result, it is up to the user to import those from the underlying libraries if they want to handle them. This detracts from the abstraction provided by this library. Users have to write cloud-specific code to handle errors due to authentication or connection failures.
It would be nice if an attempt was made to catch these exceptions and wrap them with an appropriate exception type provided by this library.
I don't want to have to write code like this:
```python
from azure.core.exceptions import ClientAuthenticationError
from botocore.exceptions import NoCredentialsError
try:
path = CloudPath(somepath)
with path.open():
...
except (ClientAuthenticationError, NoCredentialsError,...):
```
And if I need to worry about what implementation libraries are installed the code becomes even more horrible.
I would rather have cloudpathlib intercept those exceptions and wrap them with its own exceptions so I could write something like:
```python
from cloudpathlib import AuthenticationError
try:
path = CloudPath(somepath)
with path.open():
...
except AuthenticationError:
```
Contributor guide
Assessment
This issue has not been assessed yet.