1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add missing typed error in truncindex

Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
Doug Davis 2015-07-30 07:51:19 -07:00
parent 4ed3e3a5b2
commit 18b1381335

View file

@ -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