From 1fa7ebc45777d17e9976f64de5d59b8394245380 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Tue, 27 Jun 2023 14:26:39 +0300 Subject: [PATCH] [#455] Fix non-informative message when parse node attributes Signed-off-by: Anton Nikiforov --- pkg/util/attributes/parser.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/util/attributes/parser.go b/pkg/util/attributes/parser.go index 8016c0160..f8cc97189 100644 --- a/pkg/util/attributes/parser.go +++ b/pkg/util/attributes/parser.go @@ -1,7 +1,6 @@ package attributes import ( - "errors" "fmt" "strings" @@ -21,7 +20,7 @@ func ReadNodeAttributes(dst *netmap.NodeInfo, attrs []string) error { k, v, found := strings.Cut(line, keyValueSeparator) if !found { - return errors.New("missing attribute key and/or value") + return fmt.Errorf("wrong format for node attribute: '%s'", attrs[i]) } _, ok := cache[k] @@ -36,9 +35,9 @@ func ReadNodeAttributes(dst *netmap.NodeInfo, attrs []string) error { v = replaceEscaping(v, true) if k == "" { - return errors.New("empty key") + return fmt.Errorf("empty key in node attribute: '%s'", attrs[i]) } else if v == "" { - return errors.New("empty value") + return fmt.Errorf("empty value in node attribute: '%s'", attrs[i]) } dst.SetAttribute(k, v) -- 2.45.2