Use error interfaces for content/metadata

These interfaces allow us to preserve both the checking of error "cause"
as well as messages returned from the gRPC API so that the client gets
full error reason instead of a default "metadata: not found" in the case
of a missing image.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
This commit is contained in:
Phil Estes
2017-06-12 16:33:06 -04:00
parent f5c587c1f7
commit e10a9aff7d
14 changed files with 254 additions and 70 deletions

View File

@@ -1,9 +1,8 @@
package content
import (
"fmt"
"sync"
"github.com/pkg/errors"
)
// Handles locking references
@@ -20,7 +19,7 @@ func tryLock(ref string) error {
defer locksMu.Unlock()
if _, ok := locks[ref]; ok {
return errors.Wrapf(ErrLocked, "key %s is locked", ref)
return ErrLocked(fmt.Sprintf("key %s is locked", ref))
}
locks[ref] = struct{}{}