Skip to content

Commit

Permalink
chore: improving error log for oras push and oras attach when the…
Browse files Browse the repository at this point in the history
… annotation file is invalid (oras-project#1026)

Signed-off-by: Shubham Singh <shubhammahar1306@gmail.com>
  • Loading branch information
1Shubham7 authored and shizhMSFT committed Aug 3, 2023
1 parent 7485f1e commit a45a74a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/oras/internal/option/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string
}
if opts.AnnotationFilePath != "" {
if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil {
return nil, err
errStr := err.Error()
docLink := " Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations."
if !strings.HasSuffix(errStr, ".") {
docLink = "."+docLink
}
return nil, fmt.Errorf("failed to load annotations from %s: %w" +
docLink, opts.AnnotationFilePath, err)
}
}
if len(opts.ManifestAnnotations) != 0 {
Expand Down

0 comments on commit a45a74a

Please sign in to comment.