From 8e069cb4e865dd3faa728ae4868a8eb8615191dc Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Thu, 30 Jul 2015 07:51:19 -0700 Subject: [PATCH] Add missing typed error in truncindex Signed-off-by: Doug Davis Upstream-commit: 18b13813358f9cb9f3028f34f59ed254bd16bb3f Component: engine --- components/engine/pkg/truncindex/truncindex.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/engine/pkg/truncindex/truncindex.go b/components/engine/pkg/truncindex/truncindex.go index 33ea2b5cfc..a93fe1d6e4 100644 --- a/components/engine/pkg/truncindex/truncindex.go +++ b/components/engine/pkg/truncindex/truncindex.go @@ -15,8 +15,13 @@ import ( var ( // ErrEmptyPrefix is an error returned if the prefix was empty. ErrEmptyPrefix = errors.New("Prefix can't be empty") - // ErrAmbiguousPrefix is an error returned if the prefix was ambiguous (multiple ids for the prefix). + + // ErrAmbiguousPrefix is returned if the prefix was ambiguous + // (multiple ids for the prefix). ErrAmbiguousPrefix = errors.New("Multiple IDs found with provided prefix") + + // ErrIllegalChar is returned when a space is in the ID + ErrIllegalChar = errors.New("illegal character: ' '") ) // TruncIndex allows the retrieval of string identifiers by any of their unique prefixes. @@ -44,7 +49,7 @@ func NewTruncIndex(ids []string) (idx *TruncIndex) { func (idx *TruncIndex) addID(id string) error { if strings.Contains(id, " ") { - return fmt.Errorf("illegal character: ' '") + return ErrIllegalChar } if id == "" { return ErrEmptyPrefix