|
|
@@ -168,7 +168,7 @@ func (r *ResponseHandler) ReadBody(maxBodySize int64) ([]byte, *locale.Localized
|
|
|
}
|
|
|
|
|
|
if len(buffer) == 0 {
|
|
|
- return nil, locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: empty response body"), "error.http_empty_response_body")
|
|
|
+ return nil, locale.NewLocalizedErrorWrapper(errors.New("fetcher: empty response body"), "error.http_empty_response_body")
|
|
|
}
|
|
|
|
|
|
return buffer, nil
|
|
|
@@ -192,11 +192,11 @@ func (r *ResponseHandler) LocalizedError() *locale.LocalizedErrorWrapper {
|
|
|
|
|
|
switch r.httpResponse.StatusCode {
|
|
|
case http.StatusUnauthorized:
|
|
|
- return locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: access unauthorized (401 status code)"), "error.http_not_authorized")
|
|
|
+ return locale.NewLocalizedErrorWrapper(errors.New("fetcher: access unauthorized (401 status code)"), "error.http_not_authorized")
|
|
|
case http.StatusForbidden:
|
|
|
- return locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: access forbidden (403 status code)"), "error.http_forbidden")
|
|
|
+ return locale.NewLocalizedErrorWrapper(errors.New("fetcher: access forbidden (403 status code)"), "error.http_forbidden")
|
|
|
case http.StatusTooManyRequests:
|
|
|
- return locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: too many requests (429 status code)"), "error.http_too_many_requests")
|
|
|
+ return locale.NewLocalizedErrorWrapper(errors.New("fetcher: too many requests (429 status code)"), "error.http_too_many_requests")
|
|
|
case http.StatusNotFound, http.StatusGone:
|
|
|
return locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: resource not found (%d status code)", r.httpResponse.StatusCode), "error.http_resource_not_found")
|
|
|
case http.StatusInternalServerError:
|
|
|
@@ -216,7 +216,7 @@ func (r *ResponseHandler) LocalizedError() *locale.LocalizedErrorWrapper {
|
|
|
if r.httpResponse.StatusCode != 304 {
|
|
|
// Content-Length = -1 when no Content-Length header is sent.
|
|
|
if r.httpResponse.ContentLength == 0 {
|
|
|
- return locale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: empty response body"), "error.http_empty_response_body")
|
|
|
+ return locale.NewLocalizedErrorWrapper(errors.New("fetcher: empty response body"), "error.http_empty_response_body")
|
|
|
}
|
|
|
}
|
|
|
|