Unwrap error message.

Signed-off-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Felix Fontein 2024-03-02 13:22:22 +01:00 committed by Nicolas De loof
parent 2e85b3c265
commit 466374bdd0
1 changed files with 10 additions and 2 deletions

View File

@ -169,6 +169,14 @@ func imageAlreadyPresent(serviceImage string, localImages map[string]string) boo
return ok && tagged.Tag() != "latest"
}
func getUnwrappedErrorMessage(err error) string {
derr := errors.Unwrap(err)
if derr != nil {
return getUnwrappedErrorMessage(derr)
}
return err.Error()
}
func (s *composeService) pullServiceImage(ctx context.Context, service types.ServiceConfig,
configFile driver.Auth, w progress.Writer, quietPull bool, defaultPlatform string) (string, error) {
w.Event(progress.Event{
@ -203,7 +211,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
ID: service.Name,
Status: progress.Warning,
Text: "Warning",
StatusText: err.Error(),
StatusText: getUnwrappedErrorMessage(err),
})
return "", WrapCategorisedComposeError(err, PullFailure)
}
@ -213,7 +221,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
ID: service.Name,
Status: progress.Error,
Text: "Error",
StatusText: err.Error(),
StatusText: getUnwrappedErrorMessage(err),
})
return "", WrapCategorisedComposeError(err, PullFailure)
}