Output bad key in error when incorrectly parsed (#2438)

In the function that parses the tags passed to the create snapshot
command, if the tag had an incorrect format, an error message would
be returned which did not show the tag itself, making debugging such
error difficult. This commit includes the tag in the error message to
make debugging easier.
This commit is contained in:
Ali Dowair
2022-09-26 07:37:29 +03:00
committed by GitHub
parent 62a61e6a0e
commit 883f273579

View File

@@ -173,7 +173,7 @@ func getTags(tagStrings []string) (map[string]string, error) {
for _, tagkv := range tagStrings {
parts := strings.SplitN(tagkv, ":", numberOfPartsInTagString)
if len(parts) != numberOfPartsInTagString {
return nil, errors.New("Invalid tag format. Requires <key>:<value>")
return nil, errors.Errorf("Invalid tag format (%s). Requires <key>:<value>", tagkv)
}
key := tagKeyPrefix + parts[0]