Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit ada2191

Browse files
Better handle errors during installation list
Signed-off-by: Silvin Lubecki <[email protected]>
1 parent 54fa1a2 commit ada2191

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

internal/commands/list.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func runList(dockerCli command.Cli, opts listOptions, installerContext *cliopts.
8787
return err
8888
}
8989
if err != nil {
90-
return err
90+
fmt.Fprintf(dockerCli.Err(), "%s\n", err)
9191
}
9292

9393
if opts.template == "json" {
@@ -142,23 +142,26 @@ func getInstallations(installationStore store.InstallationStore, fetcher Service
142142
return nil, err
143143
}
144144
installations := make([]Installation, len(installationNames))
145+
var errs []string
145146
for i, name := range installationNames {
146147
installation, err := installationStore.Read(name)
147148
if err != nil {
148149
return nil, err
149150
}
150151
services, err := fetcher.getServices(installation)
151152
if err != nil {
152-
return nil, err
153+
errs = append(errs, err.Error())
153154
}
154155
installations[i] = Installation{Installation: installation, Services: services}
155156
}
156157
// Sort installations with last modified first
157158
sort.Slice(installations, func(i, j int) bool {
158159
return installations[i].Modified.After(installations[j].Modified)
159160
})
160-
161-
return installations, nil
161+
if len(errs) > 0 {
162+
err = errors.New(strings.Join(errs, "\n"))
163+
}
164+
return installations, err
162165
}
163166

164167
type ServiceStatus struct {

0 commit comments

Comments
 (0)