@@ -63,12 +63,12 @@ func Batch(cfg *config.Configuration, objects []*ObjectResource, operation strin
63
63
o := & batchRequest {Operation : operation , Objects : objects , TransferAdapterNames : transferAdapters }
64
64
by , err := json .Marshal (o )
65
65
if err != nil {
66
- return nil , "" , errors .Error (err )
66
+ return nil , "" , errors .Wrap (err , "batch request" )
67
67
}
68
68
69
69
req , err := NewBatchRequest (cfg , operation )
70
70
if err != nil {
71
- return nil , "" , errors .Error (err )
71
+ return nil , "" , errors .Wrap (err , "batch request" )
72
72
}
73
73
74
74
req .Header .Set ("Content-Type" , MediaType )
@@ -81,7 +81,6 @@ func Batch(cfg *config.Configuration, objects []*ObjectResource, operation strin
81
81
res , bresp , err := DoBatchRequest (cfg , req )
82
82
83
83
if err != nil {
84
-
85
84
if res == nil {
86
85
return nil , "" , errors .NewRetriableError (err )
87
86
}
@@ -97,17 +96,16 @@ func Batch(cfg *config.Configuration, objects []*ObjectResource, operation strin
97
96
98
97
switch res .StatusCode {
99
98
case 404 , 410 :
100
- tracerx .Printf ("api: batch not implemented: %d" , res .StatusCode )
101
- return nil , "" , errors .NewNotImplementedError (nil )
99
+ return nil , "" , errors .NewNotImplementedError (errors .Errorf ("api: batch not implemented: %d" , res .StatusCode ))
102
100
}
103
101
104
102
tracerx .Printf ("api error: %s" , err )
105
- return nil , "" , errors .Error (err )
103
+ return nil , "" , errors .Wrap (err , "batch response" )
106
104
}
107
105
httputil .LogTransfer (cfg , "lfs.batch" , res )
108
106
109
107
if res .StatusCode != 200 {
110
- return nil , "" , errors .Error ( fmt . Errorf ("Invalid status for %s: %d" , httputil .TraceHttpReq (req ), res .StatusCode ) )
108
+ return nil , "" , errors .Errorf ("Invalid status for %s: %d" , httputil .TraceHttpReq (req ), res .StatusCode )
111
109
}
112
110
113
111
return bresp .Objects , bresp .TransferAdapterName , nil
@@ -140,7 +138,7 @@ func Legacy(cfg *config.Configuration, objects []*ObjectResource, operation stri
140
138
func DownloadCheck (cfg * config.Configuration , oid string ) (* ObjectResource , error ) {
141
139
req , err := NewRequest (cfg , "GET" , oid )
142
140
if err != nil {
143
- return nil , errors .Error (err )
141
+ return nil , errors .Wrap (err , "download check" )
144
142
}
145
143
146
144
res , obj , err := DoLegacyRequest (cfg , req )
@@ -152,7 +150,7 @@ func DownloadCheck(cfg *config.Configuration, oid string) (*ObjectResource, erro
152
150
153
151
_ , err = obj .NewRequest ("download" , "GET" )
154
152
if err != nil {
155
- return nil , errors .Error (err )
153
+ return nil , errors .Wrap (err , "download check" )
156
154
}
157
155
158
156
return obj , nil
@@ -167,12 +165,12 @@ func UploadCheck(cfg *config.Configuration, oid string, size int64) (*ObjectReso
167
165
168
166
by , err := json .Marshal (reqObj )
169
167
if err != nil {
170
- return nil , errors .Error (err )
168
+ return nil , errors .Wrap (err , "upload check" )
171
169
}
172
170
173
171
req , err := NewRequest (cfg , "POST" , oid )
174
172
if err != nil {
175
- return nil , errors .Error (err )
173
+ return nil , errors .Wrap (err , "upload check" )
176
174
}
177
175
178
176
req .Header .Set ("Content-Type" , MediaType )
0 commit comments