main: simplify upload error handling

This commit is contained in:
Lukas Zapletal 2025-02-12 10:36:44 +01:00 committed by Michael Vogt
parent 8d03b2215c
commit 6dd8515801
4 changed files with 20 additions and 27 deletions

View file

@ -232,14 +232,13 @@ func cmdBuild(cmd *cobra.Command, args []string) error {
return err
}
var uploadUnsupported *UploadTypeUnsupportedError
var missingUploadConfig *MissingUploadConfigError
uploader, err := uploaderFor(cmd, res.ImgType.Name())
if err != nil && !errors.As(err, &missingUploadConfig) && !errors.As(err, &uploadUnsupported) {
return err
if errors.Is(err, ErrUploadTypeUnsupported) || errors.Is(err, ErrUploadConfigNotProvided) {
err = nil
}
if missingUploadConfig != nil && !missingUploadConfig.allMissing {
return fmt.Errorf("partial upload config provided: %w", err)
if err != nil {
return err
}
if uploader != nil {