Skip to content

Commit

Permalink
Improve ContainerError message compute
Browse files Browse the repository at this point in the history
Signed-off-by: Joffrey F <[email protected]>
  • Loading branch information
shin- committed Aug 17, 2017
1 parent 62fda98 commit f337495
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions docker/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,9 @@ def __init__(self, container, exit_status, command, image, stderr):
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)

Expand Down

0 comments on commit f337495

Please sign in to comment.