-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check http status code on feed downloads for a more precise error message #2049
Comments
We display a generic error (which is localizable and has translations) to the user and log out the underlying NSError from NSURLSession (from |
The error in this case is nil within didCompleteWithError. I guess that's just how URLSessionDownloadTask works - it's not http specific so doesn't check http error codes. Certain generic connection errors, like server not found, do appear in that routine, but not http status codes. |
Ah right, this error is happening later on when trying to parse the downloaded contents.. Then yeah it would be an improvement to check the http status code and maybe re-use the Feel free to make a PR on this. |
Err that string I copied/pasted doesn't make sense :). We can have a new localizable string for this then. |
Summary
Sparkle 2.0.0 is displaying "An error occurred while parsing the update feed" when the problem is actually a permission error from the web server. Checking the http statusCode would allow for a better error message.
Details:
Our feed is protected by CloudFront. If the user's access token expires, CloudFront returns a 503 error along with an HTML page explaining the issue. Sparkle's NSURLSessionDownloadTask delegate doesn't check the http status code on the download and attempts to parse the HTML error page from CloudFront. This results in the slightly erroneous but confusing error message above.
Possible Fix
I believe this can be fixed in SPUDownloader.m: didFinishDownloadingToURL by checking the statusCode and using a new error message if it indicates an error. A (Swift - sorry) example on checking the statusCode is shown below:
An improved message might be something as simple as "A network error occurred while downloading the update feed (503)."
Version
2.0.0
The text was updated successfully, but these errors were encountered: