returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: access unauthorized (401 status code)"),"error.http_not_authorized")
casehttp.StatusForbidden:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: access forbidden (403 status code)"),"error.http_forbidden")
casehttp.StatusTooManyRequests:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: too many requests (429 status code)"),"error.http_too_many_requests")
casehttp.StatusNotFound,http.StatusGone:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: resource not found (%d status code)",r.httpResponse.StatusCode),"error.http_resource_not_found")
casehttp.StatusInternalServerError:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: remote server error (%d status code)",r.httpResponse.StatusCode),"error.http_internal_server_error")
casehttp.StatusBadGateway:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: bad gateway (%d status code)",r.httpResponse.StatusCode),"error.http_bad_gateway")
casehttp.StatusServiceUnavailable:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: service unavailable (%d status code)",r.httpResponse.StatusCode),"error.http_service_unavailable")
casehttp.StatusGatewayTimeout:
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: gateway timeout (%d status code)",r.httpResponse.StatusCode),"error.http_gateway_timeout")
}
ifr.httpResponse.StatusCode>=400{
returnlocale.NewLocalizedErrorWrapper(fmt.Errorf("fetcher: unexpected status code (%d status code)",r.httpResponse.StatusCode),"error.http_unexpected_status_code",r.httpResponse.StatusCode)
}
ifr.httpResponse.StatusCode!=304{
// Content-Length = -1 when no Content-Length header is sent.