diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-07-12 19:26:14 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2018-07-13 12:50:12 -0700 |
commit | 74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15 (patch) | |
tree | 75ba256d70545d79aa61d7c57c20df886be1555f /contrib/python/podman/libs/errors.py | |
parent | 44b523c946c88e540b50d7ba59f441b5f8e0bad0 (diff) | |
download | podman-74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15.tar.gz podman-74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15.tar.bz2 podman-74ccd9ce5f29a1df4ffe70b4d8bd00c29d5d9d15.zip |
Update python directories to better support setup.py
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'contrib/python/podman/libs/errors.py')
-rw-r--r-- | contrib/python/podman/libs/errors.py | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/contrib/python/podman/libs/errors.py b/contrib/python/podman/libs/errors.py deleted file mode 100644 index b98210481..000000000 --- a/contrib/python/podman/libs/errors.py +++ /dev/null @@ -1,65 +0,0 @@ -"""Error classes and wrappers for VarlinkError.""" -from varlink import VarlinkError - - -class VarlinkErrorProxy(VarlinkError): - """Class to Proxy VarlinkError methods.""" - - def __init__(self, message, namespaced=False): - """Construct proxy from Exception.""" - super().__init__(message.as_dict(), namespaced) - self._message = message - self.__module__ = 'libpod' - - def __getattr__(self, method): - """Return attribute from proxied Exception.""" - if hasattr(self._message, method): - return getattr(self._message, method) - - try: - return self._message.parameters()[method] - except KeyError: - raise AttributeError('No such attribute: {}'.format(method)) - - -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 |