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 (#1026)

Signed-off-by: Shubham Singh <shubhammahar1306@gmail.com>
  • Loading branch information
1Shubham7 authored Jul 27, 2023
1 parent 41cb0c8 commit 0b6651a
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 0b6651a

Please sign in to comment.