diff options
author | Joffrey F <joffrey@docker.com> | 2017-08-07 12:05:40 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2017-08-07 12:06:07 -0700 |
commit | 8bcf2f27fb7f11edc454bc26c98801e1e5423020 (patch) | |
tree | 93770c4472f5f2552b69ad988270b4791cf8e441 | |
parent | b8fd8213364ae21c2981f3e51cee924738cb9b93 (diff) | |
download | docker-py-8bcf2f27fb7f11edc454bc26c98801e1e5423020.tar.gz |
Improve ContainerError message compute
Signed-off-by: Joffrey F <joffrey@docker.com>
-rw-r--r-- | docker/errors.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/docker/errors.py b/docker/errors.py index 1f8ac23..2a2f871 100644 --- a/docker/errors.py +++ b/docker/errors.py @@ -128,12 +128,9 @@ class ContainerError(DockerException): self.image = image self.stderr = stderr - if stderr is None: - msg = ("Command '{}' in image '{}' returned non-zero exit " - "status {}").format(command, image, exit_status, stderr) - else: - msg = ("Command '{}' in image '{}' returned non-zero exit " - "status {}: {}").format(command, image, exit_status, stderr) + err = ": {}".format(stderr) if stderr is not None else "" + msg = ("Command '{}' in image '{}' returned non-zero exit " + "status {}{}").format(command, image, exit_status, err) super(ContainerError, self).__init__(msg) |