MCPcopy Index your code
hub / github.com/docker/cli / cmdErrorMessage

Function cmdErrorMessage

cmd/docker/docker.go:126–134  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

124// exit code), it falls back to a generic message so that hooks can still
125// detect that the command failed.
126func 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
136func newDockerCommand(dockerCli *command.DockerCli) *cli.TopLevelCommand {
137 var (

Callers 2

runDockerFunction · 0.85
TestCmdErrorMessageFunction · 0.85

Calls 2

getExitCodeFunction · 0.70
ErrorMethod · 0.45

Tested by 1

TestCmdErrorMessageFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…