Log when truncindex.Get returns >1 container
When the user is not using the full has to retrieve a container it's possible that we find conflicts with the ids of other containers. At the moment it's just failing saying that it can not find a container, but it doesn't say why. Adding a small log saying that duplicates where found is going to help the user. Closes #8098 Signed-off-by: Alex Gonzalez <agonzalezro@gmail.com>
This commit is contained in:
parent
e4b13e4efb
commit
d27d1dfcbe
1 changed files with 4 additions and 3 deletions
|
@ -12,7 +12,8 @@ import (
|
||||||
var (
|
var (
|
||||||
// ErrNoID is thrown when attempting to use empty prefixes
|
// ErrNoID is thrown when attempting to use empty prefixes
|
||||||
ErrNoID = errors.New("prefix can't be empty")
|
ErrNoID = errors.New("prefix can't be empty")
|
||||||
errDuplicateID = errors.New("multiple IDs were found")
|
// ErrDuplicateID is thrown when a duplicated id was found
|
||||||
|
ErrDuplicateID = errors.New("multiple IDs were found")
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -98,7 +99,7 @@ func (idx *TruncIndex) Get(s string) (string, error) {
|
||||||
if id != "" {
|
if id != "" {
|
||||||
// we haven't found the ID if there are two or more IDs
|
// we haven't found the ID if there are two or more IDs
|
||||||
id = ""
|
id = ""
|
||||||
return errDuplicateID
|
return ErrDuplicateID
|
||||||
}
|
}
|
||||||
id = string(prefix)
|
id = string(prefix)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue