mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
[AltStoreCore] Includes more context when logging Patreon account errors
Includes full decoding path if possible.
This commit is contained in:
@@ -89,9 +89,9 @@ final class UpdatePatronsOperation: ResultOperation<Void>
|
|||||||
|
|
||||||
Logger.main.notice("Updated Friend Zone Patrons! Refresh ID: \(response.refreshID, privacy: .public)")
|
Logger.main.notice("Updated Friend Zone Patrons! Refresh ID: \(response.refreshID, privacy: .public)")
|
||||||
}
|
}
|
||||||
catch
|
catch let error as NSError
|
||||||
{
|
{
|
||||||
Logger.main.error("Failed to update Friend Zone Patrons. \(error.localizedDescription, privacy: .public)")
|
Logger.main.error("Failed to update Friend Zone Patrons. \(error.localizedDebugDescription ?? error.localizedDescription, privacy: .public)")
|
||||||
self.finish(.failure(error))
|
self.finish(.failure(error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,28 @@ public extension PatreonAPI
|
|||||||
completion(.failure(PatreonAPIError(.notAuthenticated)))
|
completion(.failure(PatreonAPIError(.notAuthenticated)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case .failure(let error as DecodingError):
|
||||||
|
do
|
||||||
|
{
|
||||||
|
let nsError = error as NSError
|
||||||
|
guard let codingPath = nsError.userInfo[ALTNSCodingPathKey] as? [CodingKey] else { throw error }
|
||||||
|
|
||||||
|
let rawComponents = codingPath.map { $0.intValue?.description ?? $0.stringValue }
|
||||||
|
let pathDescription = rawComponents.joined(separator: " > ")
|
||||||
|
|
||||||
|
let localizedDescription = nsError.localizedDebugDescription ?? nsError.localizedDescription
|
||||||
|
let debugDescription = localizedDescription + " Path: " + pathDescription
|
||||||
|
|
||||||
|
var userInfo = nsError.userInfo
|
||||||
|
userInfo[NSDebugDescriptionErrorKey] = debugDescription
|
||||||
|
throw NSError(domain: nsError.domain, code: nsError.code, userInfo: userInfo)
|
||||||
|
}
|
||||||
|
catch let error as NSError
|
||||||
|
{
|
||||||
|
Logger.main.error("Failed to fetch Patreon account. \(error.localizedDebugDescription ?? error.localizedDescription, privacy: .public)")
|
||||||
|
completion(.failure(error))
|
||||||
|
}
|
||||||
|
|
||||||
case .failure(let error as NSError):
|
case .failure(let error as NSError):
|
||||||
Logger.main.error("Failed to fetch Patreon account. \(error.localizedDebugDescription ?? error.localizedDescription, privacy: .public)")
|
Logger.main.error("Failed to fetch Patreon account. \(error.localizedDebugDescription ?? error.localizedDescription, privacy: .public)")
|
||||||
completion(.failure(error))
|
completion(.failure(error))
|
||||||
|
|||||||
Reference in New Issue
Block a user