From 9874680d86cc9655a6265db985e7a7c7d228cde3 Mon Sep 17 00:00:00 2001 From: Jared Patrick Date: Wed, 9 Oct 2024 08:43:53 -0400 Subject: [PATCH] separate error and nil conditions for clarity --- internal/pkg/argocd/argocd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/pkg/argocd/argocd.go b/internal/pkg/argocd/argocd.go index 0f94f52c..e1dbf96a 100644 --- a/internal/pkg/argocd/argocd.go +++ b/internal/pkg/argocd/argocd.go @@ -324,9 +324,12 @@ func SetArgoCDAppRevision(ctx context.Context, componentPath string, revision st return fmt.Errorf("Error creating ArgoCD clients: %w", err) } foundApp, err = findArgocdApp(ctx, componentPath, repo, ac.app, useSHALabelForArgoDicovery) - if foundApp == nil || err != nil { + if err != nil { return fmt.Errorf("error finding ArgoCD application for component path %s: %w", componentPath, err) } + if foundApp == nil { + return fmt.Errorf("no ArgoCD application was found for component path: %s", componentPath) + } if foundApp.Spec.Source.TargetRevision == revision { log.Infof("App %s already has revision %s", foundApp.Name, revision) return nil