cmdErrorMessage extracts an error message suitable for passing to plugin hooks. If the error's message is empty (e.g. a StatusError with only an exit code), it falls back to a generic message so that hooks can still detect that the command failed.
(err error)
| 124 | // exit code), it falls back to a generic message so that hooks can still |
| 125 | // detect that the command failed. |
| 126 | func cmdErrorMessage(err error) string { |
| 127 | if err == nil { |
| 128 | return "" |
| 129 | } |
| 130 | if msg := err.Error(); msg != "" { |
| 131 | return msg |
| 132 | } |
| 133 | return fmt.Sprintf("exited with code %d", getExitCode(err)) |
| 134 | } |
| 135 | |
| 136 | func newDockerCommand(dockerCli *command.DockerCli) *cli.TopLevelCommand { |
| 137 | var ( |
searching dependent graphs…