Fetch: Downloads Failing / Better error description
Two issues, the first is that when something fails, most of the time we get a generic request_not_successful message, which is not very useful when when trying to understand exactly why it failed.
As for the second issue,
In my app (iOS / android), the urls that are sent to the downloader may or may not be restricted (may be redirected to a paywall page if restricted).
On iOS using NSURLSessionDownloadTask , if the url is indeed a paywall, instead of it failing, the html content is returned which I can then use to check for restricted signs and act accordingly.
On android using this library, it works similarly to a certain degree. On certain urls it returns the HTML content, on others it just fails with a request_not_successful message.
An example would be :
Works on both android / iOS (Returns HTML content): http://jandonline.org/article/S2212267214006005/pdf
Works on iOS, fails on android (request_not_successful): https://www.magonlinelibrary.com/doi/pdf/10.12968/bjon.2013.22.7.364?t=
Library version: 2.3.4 Fetch configuration:
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
OkHttpClient okHttpClient = new OkHttpClient
.Builder()
.followRedirects(true)
.followSslRedirects(true)
.cookieJar(new JavaNetCookieJar(cookieManager)).build();
FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(context)
.setDownloadConcurrentLimit(4)
.setProgressReportingInterval(100)
.setNamespace("PPDownloader")
.setHttpDownloader(new OkHttpDownloader(okHttpClient))
.build();
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (8 by maintainers)
@tonyofrancis Ok, thanks for having a look. I’ll try to give you other examples of when this issue occurs this weekend.
@jpvs0101 because the error is not always a server error. It could be a library error, or invalid configuration on the developers part who knows. Returning the Error object with the attached throwable is the best option.
@cdn34
request_not_successfulwhen It is unable to determine the true cause of the error. It will only get better when the library matures and issues like this are reported. Fetch also returns the exceptions that are thrown when possible.download.getError().getThrowable(). Note:.getThrowable()may return null.I will keep this issue ticket open as an enhancement for the library. Working on a fix that will report these error codes for the next release