@@ -116,15 +116,15 @@ func headersToStore(res *http.Response) map[string]string {
116
116
func requestImage (imageURL string , header http.Header ) (* http.Response , error ) {
117
117
req , err := http .NewRequest ("GET" , imageURL , nil )
118
118
if err != nil {
119
- return nil , ierrors .New (404 , err .Error (), msgSourceImageIsUnreachable ). SetUnexpected ( config . ReportDownloadingErrors )
119
+ return nil , ierrors .New (404 , err .Error (), msgSourceImageIsUnreachable )
120
120
}
121
121
122
122
if _ , ok := enabledSchemes [req .URL .Scheme ]; ! ok {
123
123
return nil , ierrors .New (
124
124
404 ,
125
125
fmt .Sprintf ("Unknown sheme: %s" , req .URL .Scheme ),
126
126
msgSourceImageIsUnreachable ,
127
- ). SetUnexpected ( config . ReportDownloadingErrors )
127
+ )
128
128
}
129
129
130
130
req .Header .Set ("User-Agent" , config .UserAgent )
@@ -137,7 +137,7 @@ func requestImage(imageURL string, header http.Header) (*http.Response, error) {
137
137
138
138
res , err := downloadClient .Do (req )
139
139
if err != nil {
140
- return nil , ierrors .New (500 , checkTimeoutErr (err ).Error (), msgSourceImageIsUnreachable ). SetUnexpected ( config . ReportDownloadingErrors )
140
+ return nil , ierrors .New (500 , checkTimeoutErr (err ).Error (), msgSourceImageIsUnreachable )
141
141
}
142
142
143
143
if res .StatusCode == http .StatusNotModified {
@@ -154,7 +154,7 @@ func requestImage(imageURL string, header http.Header) (*http.Response, error) {
154
154
}
155
155
156
156
msg := fmt .Sprintf ("Status: %d; %s" , res .StatusCode , string (body ))
157
- return nil , ierrors .New (status , msg , msgSourceImageIsUnreachable ). SetUnexpected ( config . ReportDownloadingErrors )
157
+ return nil , ierrors .New (status , msg , msgSourceImageIsUnreachable )
158
158
}
159
159
160
160
return res , nil
@@ -191,7 +191,7 @@ func download(imageURL string, header http.Header) (*ImageData, error) {
191
191
192
192
imgdata , err := readAndCheckImage (body , contentLength )
193
193
if err != nil {
194
- return nil , ierrors .Wrap (err , 0 ). SetUnexpected ( config . ReportDownloadingErrors )
194
+ return nil , ierrors .Wrap (err , 0 )
195
195
}
196
196
197
197
imgdata .Headers = headersToStore (res )
0 commit comments