diff options
author | Joffrey F <joffrey@docker.com> | 2017-08-07 12:05:40 -0700 |
---|---|---|
committer | Joffrey F <f.joffrey@gmail.com> | 2017-08-17 13:38:40 -0700 |
commit | f3374959b7145d0c25042d51065b5d387832d19c (patch) | |
tree | f7c108688c1ab4216aa82b213b68d46f8a1504c5 | |
parent | 62fda980e4159e54ea7920f174a2395101f964bf (diff) | |
download | docker-py-f3374959b7145d0c25042d51065b5d387832d19c.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) |