Skip to content

Commit 2fabba8

Browse files
JGAntunesemosbaugh
andcommitted
Apply suggestions from code review
Co-authored-by: Ethan Mosbaugh <[email protected]>
1 parent e6d0c86 commit 2fabba8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cmd/installer/cli/upgrade.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,10 @@ func verifyAndPromptUpgrade(ctx context.Context, flags UpgradeCmdFlags, upgradeC
369369

370370
// Validate release upgradable
371371
if err := validateIsReleaseUpgradable(ctx, upgradeConfig, kcli, isAirgap); err != nil {
372-
if validation.IsValidationError(err) {
372+
var ve *validation.ValidationError
373+
if errors.As(err, &ve) {
373374
// This is a validation error that prevents the upgrade from proceeding, expose the error directly
374-
return err
375+
return ve
375376
}
376377
return fmt.Errorf("upgrade validation execution failed: %w", err)
377378
}

pkg-new/validation/upgradable.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ func validateAppVersionDowngrade(opts UpgradableOptions) error {
115115
if opts.License.Spec.IsSemverRequired {
116116
currentVer, err := semver.NewVersion(opts.CurrentAppVersion)
117117
if err != nil {
118-
return err
118+
return fmt.Errorf("failed to parse current app version %s: %w", opts.CurrentAppVersion, err)
119119
}
120120
targetVer, err := semver.NewVersion(opts.TargetAppVersion)
121121
if err != nil {
122-
return err
122+
return fmt.Errorf("failed to parse target app version %s: %w", opts.TargetAppVersion, err)
123123
}
124124
if targetVer.LessThan(currentVer) {
125125
return NewAppVersionDowngradeError(opts.CurrentAppVersion, opts.TargetAppVersion)

0 commit comments

Comments
 (0)