Skip to content

Commit

Permalink
Unwrap error message.
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fontein <[email protected]>
  • Loading branch information
felixfontein authored and ndeloof committed Mar 25, 2024
1 parent 2e85b3c commit 466374b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/compose/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 466374b

Please sign in to comment.