Skip to content

Commit 6274fe9

Browse files
felixfonteinndeloof
authored andcommitted
Unwrap error message.
Signed-off-by: Felix Fontein <[email protected]>
1 parent 32a9d8d commit 6274fe9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: pkg/compose/pull.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ func imageAlreadyPresent(serviceImage string, localImages map[string]string) boo
169169
return ok && tagged.Tag() != "latest"
170170
}
171171

172+
func getUnwrappedErrorMessage(err error) string {
173+
derr := errors.Unwrap(err)
174+
if derr != nil {
175+
return getUnwrappedErrorMessage(derr)
176+
}
177+
return err.Error()
178+
}
179+
172180
func (s *composeService) pullServiceImage(ctx context.Context, service types.ServiceConfig,
173181
configFile driver.Auth, w progress.Writer, quietPull bool, defaultPlatform string) (string, error) {
174182
w.Event(progress.Event{
@@ -203,7 +211,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
203211
ID: service.Name,
204212
Status: progress.Warning,
205213
Text: "Warning",
206-
StatusText: err.Error(),
214+
StatusText: getUnwrappedErrorMessage(err),
207215
})
208216
return "", WrapCategorisedComposeError(err, PullFailure)
209217
}
@@ -213,7 +221,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
213221
ID: service.Name,
214222
Status: progress.Error,
215223
Text: "Error",
216-
StatusText: err.Error(),
224+
StatusText: getUnwrappedErrorMessage(err),
217225
})
218226
return "", WrapCategorisedComposeError(err, PullFailure)
219227
}

0 commit comments

Comments
 (0)