diff options
author | Jhon Honce <jhonce@redhat.com> | 2018-06-27 21:37:42 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2018-07-13 11:29:28 -0700 |
commit | 44b523c946c88e540b50d7ba59f441b5f8e0bad0 (patch) | |
tree | 744c09508b139c1aca3d7fc995fad7ff354e3667 /contrib/python/podman/libs/errors.py | |
parent | 14a6d51a8432fc0c3324fec02e8729d3032f2af2 (diff) | |
download | podman-44b523c946c88e540b50d7ba59f441b5f8e0bad0.tar.gz podman-44b523c946c88e540b50d7ba59f441b5f8e0bad0.tar.bz2 podman-44b523c946c88e540b50d7ba59f441b5f8e0bad0.zip |
remote python client for podman
* Use podman library for access
* Verbose error checking
* Planned windows and macosx ports
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 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/python/podman/libs/errors.py b/contrib/python/podman/libs/errors.py index c28afd940..b98210481 100644 --- a/contrib/python/podman/libs/errors.py +++ b/contrib/python/podman/libs/errors.py @@ -5,14 +5,21 @@ from varlink import VarlinkError class VarlinkErrorProxy(VarlinkError): """Class to Proxy VarlinkError methods.""" - def __init__(self, obj): + def __init__(self, message, namespaced=False): """Construct proxy from Exception.""" - self._obj = obj + super().__init__(message.as_dict(), namespaced) + self._message = message self.__module__ = 'libpod' - def __getattr__(self, item): - """Return item from proxied Exception.""" - return getattr(self._obj, item) + 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): |