panic with clear message (#1709)

This commit is contained in:
Quan TRAN 2021-03-09 02:13:24 +01:00 committed by GitHub
parent 927bd30fa0
commit 3215eaf710
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1989,11 +1989,14 @@ func markExcludedReleases(releases []ReleaseSpec, selectors []string, commonLabe
return nil, fmt.Errorf("Condition value must be in the form 'foo.enabled' where 'foo' can be modified as necessary") return nil, fmt.Errorf("Condition value must be in the form 'foo.enabled' where 'foo' can be modified as necessary")
} }
if v, ok := values[conditionSplit[0]]; ok { if v, ok := values[conditionSplit[0]]; ok {
if v == nil {
panic(fmt.Sprintf("environment values field '%s' is nil", conditionSplit[0]))
}
if v.(map[string]interface{})["enabled"] == true { if v.(map[string]interface{})["enabled"] == true {
conditionMatch = true conditionMatch = true
} }
} else { } else {
panic(fmt.Sprintf("environment values does not contain field %s", conditionSplit[0])) panic(fmt.Sprintf("environment values does not contain field '%s'", conditionSplit[0]))
} }
} }
res := Release{ res := Release{