Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

ATZDownloader error handling #482

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

guillaumealgis
Copy link
Member

As discussed in #479, we didn't handle errors very well in ATZDownloader.

My intuition is that we're not handling network errors well. So you probably had an error when Alcatraz downloaded the gif (which is quite large), and we cached it anyway.

This PR fixes that, and should somewhat improve performances (see below):

  • Check for the error parameter in URLSession:task:didCompleteWithError: to handle client side errors;
  • Check for the HTTP response status code, and return an NSError for any code other than 200;
  • Replace NSURLSessionDownloadTask with NSURLSessionDataTask, so the downloaded files are never written to disk (since we always loaded them in memory anyway);
  • Remove strong references to callbacks after task completion.

@guillaumealgis guillaumealgis force-pushed the feature/downloader-error-handling branch from 5249464 to bb9c39f Compare August 23, 2016 22:26
@guillaumealgis guillaumealgis force-pushed the feature/downloader-error-handling branch from bb9c39f to 4c74ec9 Compare August 26, 2016 23:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant