From 8935ba08b4c79aabb156cdfaebb2f309e6f7a3d8 Mon Sep 17 00:00:00 2001 From: Magesh K <47920326+mahee96@users.noreply.github.com> Date: Mon, 20 Jan 2025 23:03:45 +0530 Subject: [PATCH] [CoreData]: Fix: propagate coredata errors properly --- AltStore/LaunchViewController.swift | 3 +++ AltStore/Managing Apps/AppManager.swift | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index 4685f0fd..13c42c80 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -313,6 +313,9 @@ extension LaunchViewController guard case .failure(let error) = result else { return } Logger.main.error("Failed to update sources on launch. \(error.localizedDescription, privacy: .public)") + let errorDesc = ErrorProcessing(.fullError).getDescription(error: error as NSError) + print("Failed to update sources on launch. \(errorDesc)") + let toastView = ToastView(error: error) toastView.addTarget(self.destinationViewController, action: #selector(TabBarController.presentSources), for: .touchUpInside) toastView.show(in: self.destinationViewController.selectedViewController ?? self.destinationViewController) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 49a4e672..39fc0c47 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -626,6 +626,11 @@ extension AppManager self.fetchSources() { (result) in do { + // Check if the result is failure and rethrow + if case .failure(let error) = result { + throw error // Rethrow the error + } + do { let (_, context) = try result.get()