@@ -26,6 +26,14 @@ type Key struct {
2626 Version * string
2727}
2828
29+ // VersionString returns the version string or "unknown" if unset.
30+ func (k Key ) VersionString () string {
31+ if k .Version == nil {
32+ return "unknown"
33+ }
34+ return * k .Version
35+ }
36+
2937func New (ctx context.Context ) * Storage {
3038 cfg , err := config .LoadDefaultConfig (ctx )
3139 if err != nil {
@@ -47,12 +55,12 @@ func (s *Storage) Fetch(ctx context.Context, key Key) ([]byte, string, error) {
4755 VersionId : key .Version ,
4856 })
4957 if err != nil {
50- return nil , "" , fmt .Errorf ("retrieving CRL %s %s version %v : %w" , key .Bucket , key .Object , key .Version , err )
58+ return nil , "" , fmt .Errorf ("retrieving CRL %s %s version %s : %w" , key .Bucket , key .Object , key .VersionString () , err )
5159 }
5260
5361 body , err := io .ReadAll (resp .Body )
5462 if err != nil {
55- return nil , "" , fmt .Errorf ("reading CRL %s %s version %v : %w" , key .Bucket , key .Object , key .Version , err )
63+ return nil , "" , fmt .Errorf ("reading CRL %s %s version %s : %w" , key .Bucket , key .Object , key .VersionString () , err )
5664 }
5765
5866 return body , * resp .VersionId , err
@@ -86,7 +94,7 @@ func (s *Storage) Previous(ctx context.Context, key Key) (string, error) {
8694 }
8795
8896 if (! found || prevVersion == nil ) && resp .IsTruncated != nil && * resp .IsTruncated {
89- return "" , fmt .Errorf ("too many versions and pagination not implemented! %+v " , key )
97+ return "" , fmt .Errorf ("too many versions and pagination not implemented! bucket:%s object:%s version:%s " , key . Bucket , key . Object , key . VersionString () )
9098 }
9199
92100 if ! found {
0 commit comments