kill: print ID and state for non-running containers
Extend kill's error message to include the container's ID and state. This address cases where error messages caused by other containers may confuse users. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
parent
1322b41aa0
commit
0f75410e1c
|
|
@ -203,7 +203,7 @@ func (c *Container) Kill(signal uint) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.state.State != ContainerStateRunning {
|
if c.state.State != ContainerStateRunning {
|
||||||
return errors.Wrapf(ErrCtrStateInvalid, "can only kill running containers")
|
return errors.Wrapf(ErrCtrStateInvalid, "can only kill running containers. %s in state %s", c.ID(), c.state.State.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
defer c.newContainerEvent(events.Kill)
|
defer c.newContainerEvent(events.Kill)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue