Fix an error message when there are insufficient signatures.

Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
This commit is contained in:
Ying Li 2015-11-08 16:09:52 -08:00 committed by David Lawrence
parent 3398994ae0
commit ef1d5caa1a
2 changed files with 4 additions and 4 deletions

View File

@ -8,11 +8,10 @@ import (
// metadata // metadata
type ErrInsufficientSignatures struct { type ErrInsufficientSignatures struct {
Name string Name string
Err error
} }
func (e ErrInsufficientSignatures) Error() string { func (e ErrInsufficientSignatures) Error() string {
return fmt.Sprintf("tuf: insufficient signatures for %s: %s", e.Name, e.Err) return fmt.Sprintf("tuf: insufficient signatures: %s", e.Name)
} }
// ErrExpired indicates a piece of metadata has expired // ErrExpired indicates a piece of metadata has expired

View File

@ -68,8 +68,9 @@ func Sign(service CryptoService, s *data.Signed, keys ...data.PublicKey) error {
} }
if len(signatures) < 1 { if len(signatures) < 1 {
return ErrInsufficientSignatures{ return ErrInsufficientSignatures{
Name: fmt.Sprintf("Cryptoservice failed to produce any signatures for keys with IDs: %v", keyIDs), Name: fmt.Sprintf(
Err: nil, "Cryptoservice failed to produce any signatures for keys with IDs: %v",
keyIDs),
} }
} }
for _, sig := range s.Signatures { for _, sig := range s.Signatures {