libcloud-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Richards <ch...@infiniteio.com>
Subject Exceptions types
Date Thu, 10 Sep 2015 19:52:12 GMT
Howdy.

I have a general question about the design considerations of the
LibcloudError class of exceptions. Is it expected that any exceptions
generated through normal use of the APIs raise this base exception? I ask
because I've encountered a couple of examples where it doesn't, and it
makes it a bit tedious to bulletproof code without a generic catch-all
exception. For instance,

try:
  libcloud.Do_Something_API()
except libcloud.SpecificLibcloudError:
  handle_error()
except:
  pass

Here are a few I have encountered.

Local Provider: lockfile.LockFiled, FileNotFoundError
OpenStack: socket.gaierror
Amazon S3, OpenStack: ConnectionError, InterruptedError

Empirically, I've seen these errors; there are probably more lurking in the
shadows. I feel it defeats the purpose of the abstraction if I need to
understand the internals so I can properly handle normal use-case errors.

Is this behavior expected? Did these slip through the cracks? Danke!

Cheers,
Chris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message