Skip to content

Commit d096b7d

Browse files
dvdksnclaude
andcommitted
cmd/docker: render hints from errors that carry them
Hooks the new internal/hint package into the top-level error renderer. After printing the error itself, walks the chain for any error implementing hint.Hinter and prints its hint on its own line. This makes hints a first-class output, separate from the error message, without changing how errors are constructed or wrapped at call sites that don't carry a hint. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 57d2601 commit d096b7d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/docker/docker.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
cliflags "github.com/docker/cli/cli/flags"
2525
"github.com/docker/cli/cli/version"
2626
platformsignals "github.com/docker/cli/cmd/docker/internal/signals"
27+
"github.com/docker/cli/internal/hint"
2728
"github.com/moby/moby/client/pkg/versions"
2829
"github.com/sirupsen/logrus"
2930
"github.com/spf13/cobra"
@@ -48,6 +49,9 @@ func main() {
4849
if err != nil && !errdefs.IsCanceled(err) {
4950
if err.Error() != "" {
5051
_, _ = fmt.Fprintln(os.Stderr, err)
52+
if h := hint.Of(err); h != "" {
53+
_, _ = fmt.Fprintln(os.Stderr, "\n"+h)
54+
}
5155
}
5256
os.Exit(getExitCode(err))
5357
}

0 commit comments

Comments
 (0)