fix: handle missing label

This commit is contained in:
decentral1se 2021-12-25 17:02:47 +01:00
parent 6937bfbb0d
commit e2c3bc35c3
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 7 additions and 3 deletions

View File

@ -97,7 +97,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
tags, err := recipe.Tags() tags, err := recipe.Tags()
if err != nil { if err != nil {
return err logrus.Fatal(err)
} }
if len(tags) > 0 { if len(tags) > 0 {
@ -113,6 +113,10 @@ You may invoke this command in "wizard" mode and be prompted for input:
logrus.Fatal(err) 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) logrus.Warnf("discovered %s as currently synced recipe label", initTag)
prompt := &survey.Confirm{ prompt := &survey.Confirm{
@ -121,7 +125,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
var response bool var response bool
if err := survey.AskOne(prompt, &response); err != nil { if err := survey.AskOne(prompt, &response); err != nil {
return err logrus.Fatal(err)
} }
if !response { if !response {

View File

@ -284,7 +284,7 @@ func GetVersionLabelLocal(recipe Recipe) (string, error) {
} }
if label == "" { 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 return label, nil