mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-17 18:53:40 +01:00
Throws URLError.fileDoesNotExist for 404 responses
This commit is contained in:
@@ -41,6 +41,14 @@ class FetchTrustedSourcesOperation: ResultOperation<[FetchTrustedSourcesOperatio
|
|||||||
let dataTask = URLSession.shared.dataTask(with: .trustedSources) { (data, response, error) in
|
let dataTask = URLSession.shared.dataTask(with: .trustedSources) { (data, response, error) in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if let response = response as? HTTPURLResponse
|
||||||
|
{
|
||||||
|
guard response.statusCode != 404 else {
|
||||||
|
self.finish(.failure(URLError(.fileDoesNotExist, userInfo: [NSURLErrorKey: URL.trustedSources])))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
guard let data = data else { throw error! }
|
guard let data = data else { throw error! }
|
||||||
|
|
||||||
let response = try Foundation.JSONDecoder().decode(Response.self, from: data)
|
let response = try Foundation.JSONDecoder().decode(Response.self, from: data)
|
||||||
|
|||||||
@@ -46,6 +46,14 @@ class UpdatePatronsOperation: ResultOperation<Void>
|
|||||||
let dataTask = URLSession.shared.dataTask(with: .patreonInfo) { (data, response, error) in
|
let dataTask = URLSession.shared.dataTask(with: .patreonInfo) { (data, response, error) in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
if let response = response as? HTTPURLResponse
|
||||||
|
{
|
||||||
|
guard response.statusCode != 404 else {
|
||||||
|
self.finish(.failure(URLError(.fileDoesNotExist, userInfo: [NSURLErrorKey: URL.patreonInfo])))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
guard let data = data else { throw error! }
|
guard let data = data else { throw error! }
|
||||||
|
|
||||||
let response = try AltStoreCore.JSONDecoder().decode(Response.self, from: data)
|
let response = try AltStoreCore.JSONDecoder().decode(Response.self, from: data)
|
||||||
|
|||||||
Reference in New Issue
Block a user