From e2c3bc35c3c7ebb11e9d0d97ee064c709f803e42 Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Sat, 25 Dec 2021 17:02:47 +0100 Subject: [PATCH] fix: handle missing label --- cli/recipe/release.go | 8 ++++++-- pkg/recipe/recipe.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cli/recipe/release.go b/cli/recipe/release.go index 9a4b65ca..70cd748a 100644 --- a/cli/recipe/release.go +++ b/cli/recipe/release.go @@ -97,7 +97,7 @@ You may invoke this command in "wizard" mode and be prompted for input: tags, err := recipe.Tags() if err != nil { - return err + logrus.Fatal(err) } if len(tags) > 0 { @@ -113,6 +113,10 @@ You may invoke this command in "wizard" mode and be prompted for input: logrus.Fatal(err) } + if initTag == "" { + logrus.Fatalf("unable to read version for %s from synced label. Did you try running \"abra recipe sync %s\" already?", recipe.Name, recipe.Name) + } + logrus.Warnf("discovered %s as currently synced recipe label", initTag) prompt := &survey.Confirm{ @@ -121,7 +125,7 @@ You may invoke this command in "wizard" mode and be prompted for input: var response bool if err := survey.AskOne(prompt, &response); err != nil { - return err + logrus.Fatal(err) } if !response { diff --git a/pkg/recipe/recipe.go b/pkg/recipe/recipe.go index 8aa8bba4..cdf460d4 100644 --- a/pkg/recipe/recipe.go +++ b/pkg/recipe/recipe.go @@ -284,7 +284,7 @@ func GetVersionLabelLocal(recipe Recipe) (string, error) { } if label == "" { - return label, fmt.Errorf("unable to retrieve synced version label for %s", recipe.Name) + return label, fmt.Errorf("%s has no version label? try running \"abra recipe sync %s\" first?", recipe.Name, recipe.Name) } return label, nil