diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-07-13 16:34:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-13 16:34:51 -0400 |
commit | a689639a6502bab3f49b853bc2983c1b44363b2f (patch) | |
tree | 75ba256d70545d79aa61d7c57c20df886be1555f /contrib/python/podman/libs/errors.py | |
parent | 14a6d51a8432fc0c3324fec02e8729d3032f2af2 (diff) | |
parent | 74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15 (diff) | |
download | podman-a689639a6502bab3f49b853bc2983c1b44363b2f.tar.gz podman-a689639a6502bab3f49b853bc2983c1b44363b2f.tar.bz2 podman-a689639a6502bab3f49b853bc2983c1b44363b2f.zip |
Merge pull request #1081 from jwhonce/wip/client
remote python client for podman
Diffstat (limited to 'contrib/python/podman/libs/errors.py')
-rw-r--r-- | contrib/python/podman/libs/errors.py | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/contrib/python/podman/libs/errors.py b/contrib/python/podman/libs/errors.py deleted file mode 100644 index c28afd940..000000000 --- a/contrib/python/podman/libs/errors.py +++ /dev/null @@ -1,58 +0,0 @@ -"""Error classes and wrappers for VarlinkError.""" -from varlink import VarlinkError - - -class VarlinkErrorProxy(VarlinkError): - """Class to Proxy VarlinkError methods.""" - - def __init__(self, obj): - """Construct proxy from Exception.""" - self._obj = obj - self.__module__ = 'libpod' - - def __getattr__(self, item): - """Return item from proxied Exception.""" - return getattr(self._obj, item) - - -class ContainerNotFound(VarlinkErrorProxy): - """Raised when Client can not find requested container.""" - - pass - - -class ImageNotFound(VarlinkErrorProxy): - """Raised when Client can not find requested image.""" - - pass - - -class ErrorOccurred(VarlinkErrorProxy): - """Raised when an error occurs during the execution. - - See error() to see actual error text. - """ - - pass - - -class RuntimeError(VarlinkErrorProxy): - """Raised when Client fails to connect to runtime.""" - - pass - - -error_map = { - 'io.projectatomic.podman.ContainerNotFound': ContainerNotFound, - 'io.projectatomic.podman.ErrorOccurred': ErrorOccurred, - 'io.projectatomic.podman.ImageNotFound': ImageNotFound, - 'io.projectatomic.podman.RuntimeError': RuntimeError, -} - - -def error_factory(exception): - """Map Exceptions to a discrete type.""" - try: - return error_map[exception.error()](exception) - except KeyError: - return exception |