Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: added ErrorPushSignatureFailed #271

Merged
merged 2 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
package notation

//
type ErrorPushSignatureFailed struct {
Msg string
}

func (e ErrorPushSignatureFailed) Error() string {
if e.Msg != "" {
return "failed to push signature to registry with error: " + e.Msg
}
return "failed to push signature to registry"
}

// ErrorVerificationInconclusive is used when signature verification fails due to a runtime error (e.g. a network error)
type ErrorVerificationInconclusive struct {
Msg string
Expand Down
4 changes: 2 additions & 2 deletions notation.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func Sign(ctx context.Context, signer Signer, repo registry.Repository, opts Sig
_, _, err = repo.PushSignature(ctx, opts.SignatureMediaType, sig, targetDesc, annotations)
if err != nil {
logger.Error("Failed to push the signature")
return ocispec.Descriptor{}, err
return ocispec.Descriptor{}, ErrorPushSignatureFailed{Msg: err.Error()}
}

return targetDesc, nil
Expand Down Expand Up @@ -339,4 +339,4 @@ func generateAnnotations(signerInfo *signature.SignerInfo, annotations map[strin

annotations[annotationX509ChainThumbprint] = string(val)
return annotations, nil
}
}