drivendataorg / drivendataorg/cloudpathlib

Wrap exceptions from cloud SDKs

Abierto
#167 0 comentarios 0 reacciones 0 asignados Ver en GitHub
design decision enhancement
Lenguaje dominante
Python
Estrellas
628
Forks
88
Merge medio
17 h 28 min
PR fusionados (30 d)
2

Descripción

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:

```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.