From 0c8511f222e81b26f21d48a90da980b8a00fd1ea Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 8 Dec 2016 18:51:30 +0100 Subject: [PATCH] provide better error when key not found Signed-off-by: Antonio Murdaca --- vendor/github.com/containers/image/signature/mechanism.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/github.com/containers/image/signature/mechanism.go b/vendor/github.com/containers/image/signature/mechanism.go index 196ad927..9b1b47ff 100644 --- a/vendor/github.com/containers/image/signature/mechanism.go +++ b/vendor/github.com/containers/image/signature/mechanism.go @@ -76,6 +76,9 @@ func (m gpgSigningMechanism) ImportKeysFromBytes(blob []byte) ([]string, error) func (m gpgSigningMechanism) Sign(input []byte, keyIdentity string) ([]byte, error) { key, err := m.ctx.GetKey(keyIdentity, true) if err != nil { + if e, ok := err.(gpgme.Error); ok && e.Code() == gpgme.ErrorEOF { + return nil, fmt.Errorf("key %q not found", keyIdentity) + } return nil, err } inputData, err := gpgme.NewDataBytes(input)