refresh-app: enhanced error logging when app extension validation check fails (#730)

refresh-app: enhanced error logging when app exenstion validation check fails
This commit is contained in:
Magesh K
2024-11-04 14:35:13 +05:30
committed by GitHub
parent 0c5007c8d8
commit d595b7037f
2 changed files with 14 additions and 3 deletions

View File

@@ -1427,10 +1427,11 @@ private extension AppManager
let dbAppExNames = dbAppEx.map{ $0.bundleIdentifier } let dbAppExNames = dbAppEx.map{ $0.bundleIdentifier }
let isMatching = Set(dbAppExNames) == Set(diskAppExNames) let isMatching = Set(dbAppExNames) == Set(diskAppExNames)
print("AppManager.refresh: App Extensions in DB and Disk are matching: \(isMatching)") let errMessage = "AppManager.refresh: App Extensions in DB and Disk are matching: \(isMatching)\n"
print("AppManager.refresh: dbAppEx: \(dbAppExNames); diskAppEx: \(String(describing: diskAppExNames))") + "AppManager.refresh: dbAppEx: \(dbAppExNames); diskAppEx: \(String(describing: diskAppExNames))\n"
print(errMessage)
if(!isMatching){ if(!isMatching){
completionHandler(.failure(OperationError.invalidParameters)) completionHandler(.failure(OperationError.refreshAppFailed(message: errMessage)))
} }
op.finish() op.finish()
} }

View File

@@ -35,6 +35,7 @@ extension OperationError
case noSources case noSources
case openAppFailed//(name: String) case openAppFailed//(name: String)
case missingAppGroup case missingAppGroup
case refreshAppFailed
// Connection // Connection
case noWiFi = 1200 case noWiFi = 1200
@@ -107,6 +108,10 @@ extension OperationError
OperationError(code: .anisetteV3Error, failureReason: message) OperationError(code: .anisetteV3Error, failureReason: message)
} }
static func refreshAppFailed(message: String) -> OperationError {
OperationError(code: .refreshAppFailed, failureReason: message)
}
} }
@@ -176,6 +181,11 @@ struct OperationError: ALTLocalizedError {
case .anisetteV3Error: return NSLocalizedString("An error occurred when getting anisette data from a V3 server: %@. Please try again. If the issue persists, report it on GitHub Issues!", comment: "") case .anisetteV3Error: return NSLocalizedString("An error occurred when getting anisette data from a V3 server: %@. Please try again. If the issue persists, report it on GitHub Issues!", comment: "")
case .cacheClearError: return NSLocalizedString("An error occurred while clearing cache: %@", comment: "") case .cacheClearError: return NSLocalizedString("An error occurred while clearing cache: %@", comment: "")
case .SideJITIssue: return NSLocalizedString("An error occurred while using SideJIT: %@", comment: "") case .SideJITIssue: return NSLocalizedString("An error occurred while using SideJIT: %@", comment: "")
case .refreshAppFailed:
let message = self._failureReason ?? ""
return String(format: NSLocalizedString("Unable to refresh App\n%@", comment: ""), message)
} }
} }