Przeglądaj źródła

Log error instead of error.localizedDescription

Sam King 1 rok temu
rodzic
commit
0345b49606
58 zmienionych plików z 207 dodań i 207 usunięć
  1. 7 7
      Model/CoreDataStack.swift
  2. 8 8
      Trio Watch App Extension/WatchState+Requests.swift
  3. 2 2
      Trio Watch App Extension/WatchState.swift
  4. 9 9
      Trio/Sources/APS/APSManager.swift
  5. 5 5
      Trio/Sources/APS/CGM/BluetoothTransmitter.swift
  6. 2 2
      Trio/Sources/APS/DeviceDataManager.swift
  7. 1 1
      Trio/Sources/APS/FetchGlucoseManager.swift
  8. 1 1
      Trio/Sources/APS/Storage/CarbsStorage.swift
  9. 1 1
      Trio/Sources/APS/Storage/ContactImageStorage.swift
  10. 4 4
      Trio/Sources/APS/Storage/DeterminationStorage.swift
  11. 2 2
      Trio/Sources/APS/Storage/GlucoseStorage.swift
  12. 1 1
      Trio/Sources/APS/Storage/OverrideStorage.swift
  13. 1 1
      Trio/Sources/APS/Storage/TDDStorage.swift
  14. 4 4
      Trio/Sources/Application/AppDelegate.swift
  15. 1 1
      Trio/Sources/Application/TrioApp.swift
  16. 2 2
      Trio/Sources/Helpers/MainChartHelper.swift
  17. 3 3
      Trio/Sources/Helpers/PropertyWrappers/PersistedProperty.swift
  18. 9 9
      Trio/Sources/Modules/Adjustments/AdjustmentsStateModel+Extensions/AdjustmentsStateModel+Overrides.swift
  19. 6 6
      Trio/Sources/Modules/Adjustments/AdjustmentsStateModel+Extensions/AdjustmentsStateModel+TempTargets.swift
  20. 1 1
      Trio/Sources/Modules/AlgorithmAdvancedSettings/AlgorithmAdvancedSettingsStateModel.swift
  21. 2 2
      Trio/Sources/Modules/AutosensSettings/AutosensSettingsStateModel.swift
  22. 1 1
      Trio/Sources/Modules/BasalProfileEditor/BasalProfileEditorStateModel.swift
  23. 1 1
      Trio/Sources/Modules/Calibrations/CalibrationsStateModel.swift
  24. 1 1
      Trio/Sources/Modules/CarbRatioEditor/CarbRatioEditorStateModel.swift
  25. 7 7
      Trio/Sources/Modules/DataTable/DataTableStateModel.swift
  26. 1 1
      Trio/Sources/Modules/Home/HomeStateModel+Setup/BatterySetup.swift
  27. 1 1
      Trio/Sources/Modules/Home/HomeStateModel+Setup/CurrentTDDSetup.swift
  28. 2 2
      Trio/Sources/Modules/Home/HomeStateModel+Setup/DeterminationSetup.swift
  29. 1 1
      Trio/Sources/Modules/Home/HomeStateModel+Setup/ForecastSetup.swift
  30. 1 1
      Trio/Sources/Modules/Home/HomeStateModel+Setup/GlucoseSetup.swift
  31. 4 4
      Trio/Sources/Modules/Home/HomeStateModel+Setup/OverrideSetup.swift
  32. 3 3
      Trio/Sources/Modules/Home/HomeStateModel+Setup/PumpHistorySetup.swift
  33. 2 2
      Trio/Sources/Modules/Home/HomeStateModel+Setup/TempTargetSetup.swift
  34. 1 1
      Trio/Sources/Modules/Home/HomeStateModel.swift
  35. 1 1
      Trio/Sources/Modules/ISFEditor/ISFEditorStateModel.swift
  36. 3 3
      Trio/Sources/Modules/NightscoutConfig/NightscoutConfigStateModel.swift
  37. 1 1
      Trio/Sources/Modules/Onboarding/OnboardingStateModel+Nightscout.swift
  38. 1 1
      Trio/Sources/Modules/Stat/StatStateModel+Setup/BolusStatsSetup.swift
  39. 1 1
      Trio/Sources/Modules/Stat/StatStateModel+Setup/LoopChartSetup.swift
  40. 1 1
      Trio/Sources/Modules/Stat/StatStateModel+Setup/TDDSetup.swift
  41. 2 2
      Trio/Sources/Modules/Stat/StatStateModel.swift
  42. 1 1
      Trio/Sources/Modules/TargetsEditor/TargetsEditorStateModel.swift
  43. 6 6
      Trio/Sources/Modules/Treatments/TreatmentsStateModel.swift
  44. 2 2
      Trio/Sources/Services/BolusCalculator/BolusCalculationManager.swift
  45. 1 1
      Trio/Sources/Services/Calendar/CalendarManager.swift
  46. 7 7
      Trio/Sources/Services/HealthKit/HealthKitManager.swift
  47. 2 2
      Trio/Sources/Services/LiveActivity/LiveActivityManager.swift
  48. 9 9
      Trio/Sources/Services/Network/Nightscout/NightscoutAPI.swift
  49. 24 24
      Trio/Sources/Services/Network/Nightscout/NightscoutManager.swift
  50. 4 4
      Trio/Sources/Services/Network/TidepoolManager.swift
  51. 3 3
      Trio/Sources/Services/RemoteControl/TrioRemoteControl+Override.swift
  52. 1 1
      Trio/Sources/Services/RemoteControl/TrioRemoteControl+TempTarget.swift
  53. 11 11
      Trio/Sources/Services/Storage/FileStorage.swift
  54. 1 1
      Trio/Sources/Services/UserNotifications/UserNotificationsManager.swift
  55. 14 14
      Trio/Sources/Services/WatchManager/AppleWatchManager.swift
  56. 5 5
      Trio/Sources/Services/WatchManager/GarminManager.swift
  57. 4 4
      Trio/Sources/Shortcuts/Override/OverridePresetsIntentRequest.swift
  58. 4 4
      Trio/Sources/Shortcuts/TempPresets/TempPresetsIntentRequest.swift

+ 7 - 7
Model/CoreDataStack.swift

@@ -114,7 +114,7 @@ class CoreDataStack: ObservableObject {
         do {
             try await fetchPersistentHistoryTransactionsAndChanges()
         } catch {
-            debug(.coreData, "\(error.localizedDescription)")
+            debug(.coreData, "\(error)")
         }
     }
 
@@ -162,7 +162,7 @@ class CoreDataStack: ObservableObject {
             } catch {
                 debug(
                     .coreData,
-                    "\(DebuggingIdentifiers.failed) Failed to delete persistent history from before \(date): \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Failed to delete persistent history from before \(date): \(error)"
                 )
             }
         }
@@ -194,7 +194,7 @@ class CoreDataStack: ObservableObject {
         try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in
             persistentContainer.loadPersistentStores { storeDescription, error in
                 if let error = error {
-                    warning(.coreData, "Failed to load persistent stores: \(error.localizedDescription)")
+                    warning(.coreData, "Failed to load persistent stores: \(error)")
                     continuation.resume(throwing: error)
                 } else {
                     debug(.coreData, "Successfully loaded persistent store: \(storeDescription.url?.absoluteString ?? "unknown")")
@@ -242,7 +242,7 @@ class CoreDataStack: ObservableObject {
             debug(.coreData, "Core Data stack initialized successfully")
 
         } catch {
-            debug(.coreData, "Failed to initialize Core Data stack: \(error.localizedDescription)")
+            debug(.coreData, "Failed to initialize Core Data stack: \(error)")
 
             // If we still have retries left, try again after a delay
             if retryCount < maxRetries {
@@ -280,7 +280,7 @@ extension CoreDataStack {
                 try viewContext.save()
                 debug(.coreData, "Successfully deleted data. \(DebuggingIdentifiers.succeeded)")
             } catch {
-                debug(.coreData, "Failed to delete data: \(error.localizedDescription)")
+                debug(.coreData, "Failed to delete data: \(error)")
             }
         }
     }
@@ -339,7 +339,7 @@ extension CoreDataStack {
 
             debug(.coreData, "Successfully deleted data older than \(days) days. \(DebuggingIdentifiers.succeeded)")
         } catch {
-            debug(.coreData, "Failed to fetch or delete data: \(error.localizedDescription) \(DebuggingIdentifiers.failed)")
+            debug(.coreData, "Failed to fetch or delete data: \(error) \(DebuggingIdentifiers.failed)")
             throw CoreDataError.unexpectedError(error: error, function: callingFunction, file: callingClass)
         }
     }
@@ -406,7 +406,7 @@ extension CoreDataStack {
                 "Successfully deleted \(childType) data related to \(parentType) objects older than \(days) days. \(DebuggingIdentifiers.succeeded)"
             )
         } catch {
-            debug(.coreData, "Failed to fetch or delete data: \(error.localizedDescription) \(DebuggingIdentifiers.failed)")
+            debug(.coreData, "Failed to fetch or delete data: \(error) \(DebuggingIdentifiers.failed)")
             throw CoreDataError.unexpectedError(error: error, function: callingFunction, file: callingClass)
         }
     }

+ 8 - 8
Trio Watch App Extension/WatchState+Requests.swift

@@ -25,7 +25,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("Error sending bolus request: \(error.localizedDescription)")
+                await WatchLogger.shared.log("Error sending bolus request: \(error)")
             }
         }
 
@@ -59,7 +59,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("Error sending carbs request: \(error.localizedDescription)")
+                await WatchLogger.shared.log("Error sending carbs request: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }
@@ -91,7 +91,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("⌚️ Error sending cancel override request: \(error.localizedDescription)")
+                await WatchLogger.shared.log("⌚️ Error sending cancel override request: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }
@@ -124,7 +124,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("⌚️ Error sending activate override request: \(error.localizedDescription)")
+                await WatchLogger.shared.log("⌚️ Error sending activate override request: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }
@@ -156,7 +156,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("⌚️ Error sending cancel temp target request: \(error.localizedDescription)")
+                await WatchLogger.shared.log("⌚️ Error sending cancel temp target request: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }
@@ -189,7 +189,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("⌚️ Error sending activate temp target request: \(error.localizedDescription)")
+                await WatchLogger.shared.log("⌚️ Error sending activate temp target request: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }
@@ -222,7 +222,7 @@ extension WatchState {
 
         session.sendMessage(message, replyHandler: nil) { error in
             Task {
-                await WatchLogger.shared.log("Error requesting bolus recommendation: \(error.localizedDescription)")
+                await WatchLogger.shared.log("Error requesting bolus recommendation: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }
@@ -254,7 +254,7 @@ extension WatchState {
 
             session.sendMessage(message, replyHandler: nil) { error in
                 Task {
-                    await WatchLogger.shared.log("⌚️ Error requesting WatchState update: \(error.localizedDescription)")
+                    await WatchLogger.shared.log("⌚️ Error requesting WatchState update: \(error)")
                     await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                     await WatchLogger.shared.persistLogsLocally()
                 }

+ 2 - 2
Trio Watch App Extension/WatchState.swift

@@ -151,7 +151,7 @@ import WatchConnectivity
         DispatchQueue.main.async {
             if let error = error {
                 Task {
-                    await WatchLogger.shared.log("⌚️ Watch session activation failed: \(error.localizedDescription)", force: true)
+                    await WatchLogger.shared.log("⌚️ Watch session activation failed: \(error)", force: true)
                     await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                     await WatchLogger.shared.persistLogsLocally()
                 }
@@ -272,7 +272,7 @@ import WatchConnectivity
     func session(_: WCSession, didFinish _: WCSessionUserInfoTransfer, error: (any Error)?) {
         if let error = error {
             Task {
-                await WatchLogger.shared.log("⌚️ transferUserInfo failed with error: \(error.localizedDescription)")
+                await WatchLogger.shared.log("⌚️ transferUserInfo failed with error: \(error)")
                 await WatchLogger.shared.log("⌚️ Saving logs to disk as fallback!")
                 await WatchLogger.shared.persistLogsLocally()
             }

+ 9 - 9
Trio/Sources/APS/APSManager.swift

@@ -144,7 +144,7 @@ final class BaseAPSManager: APSManager, Injectable {
                     } catch {
                         debug(
                             .apsManager,
-                            "\(DebuggingIdentifiers.failed) Error creating profiles: \(error.localizedDescription)"
+                            "\(DebuggingIdentifiers.failed) Error creating profiles: \(error)"
                         )
                     }
                 }
@@ -226,7 +226,7 @@ final class BaseAPSManager: APSManager, Injectable {
                 updatedStats.duration = roundDouble((updatedStats.end! - updatedStats.start).timeInterval / 60, 2)
                 updatedStats.loopStatus = error.localizedDescription
                 await loopCompleted(error: error, loopStatRecord: updatedStats)
-                debug(.apsManager, "\(DebuggingIdentifiers.failed) Failed to complete Loop: \(error.localizedDescription)")
+                debug(.apsManager, "\(DebuggingIdentifiers.failed) Failed to complete Loop: \(error)")
             }
 
             // Cleanup background task
@@ -332,7 +332,7 @@ final class BaseAPSManager: APSManager, Injectable {
         isLooping.send(false)
 
         if let error = error {
-            warning(.apsManager, "Loop failed with error: \(error.localizedDescription)")
+            warning(.apsManager, "Loop failed with error: \(error)")
             if let backgroundTask = backgroundTaskID {
                 await UIApplication.shared.endBackgroundTask(backgroundTask)
                 backgroundTaskID = .invalid
@@ -543,7 +543,7 @@ final class BaseAPSManager: APSManager, Injectable {
             bolusProgress.send(0)
             callback?(true, String(localized: "Bolus enacted successfully.", comment: "Success message for enacting a bolus"))
         } catch {
-            warning(.apsManager, "Bolus failed with error: \(error.localizedDescription)")
+            warning(.apsManager, "Bolus failed with error: \(error)")
             processError(APSError.pumpError(error))
             if !isSMB {
                 // Use MainActor to handle broadcaster notification
@@ -569,7 +569,7 @@ final class BaseAPSManager: APSManager, Injectable {
             debug(.apsManager, "Bolus cancelled")
             callback?(true, String(localized: "Bolus cancelled successfully.", comment: "Success message for canceling a bolus"))
         } catch {
-            debug(.apsManager, "Bolus cancellation failed with error: \(error.localizedDescription)")
+            debug(.apsManager, "Bolus cancellation failed with error: \(error)")
             processError(APSError.pumpError(error))
             callback?(
                 false,
@@ -606,7 +606,7 @@ final class BaseAPSManager: APSManager, Injectable {
             try await pump.enactTempBasal(unitsPerHour: roundedAmout, for: duration)
             debug(.apsManager, "Temp Basal succeeded")
         } catch {
-            debug(.apsManager, "Temp Basal failed with error: \(error.localizedDescription)")
+            debug(.apsManager, "Temp Basal failed with error: \(error)")
             processError(APSError.pumpError(error))
         }
     }
@@ -733,7 +733,7 @@ final class BaseAPSManager: APSManager, Injectable {
         } catch {
             debug(
                 .apsManager,
-                "\(DebuggingIdentifiers.failed) Error reporting enacted status: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error reporting enacted status: \(error)"
             )
         }
     }
@@ -1125,7 +1125,7 @@ final class BaseAPSManager: APSManager, Injectable {
         } catch {
             debug(
                 .apsManager,
-                "\(DebuggingIdentifiers.failed) Error fetching glucose for stats: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error fetching glucose for stats: \(error)"
             )
             return nil
         }
@@ -1150,7 +1150,7 @@ final class BaseAPSManager: APSManager, Injectable {
     }
 
     private func processError(_ error: Error) {
-        warning(.apsManager, "\(error.localizedDescription)")
+        warning(.apsManager, "\(error)")
         lastError.send(error)
     }
 

+ 5 - 5
Trio/Sources/APS/CGM/BluetoothTransmitter.swift

@@ -230,7 +230,7 @@ class BluetoothTransmitter: NSObject, CBCentralManagerDelegate, CBPeripheralDele
         if let error = error {
             debug(
                 .deviceManager,
-                "failed to connect, for peripheral with name \(peripheral.name ?? "'unknown'"), with error: \(error.localizedDescription), will try again"
+                "failed to connect, for peripheral with name \(peripheral.name ?? "'unknown'"), with error: \(error), will try again"
             )
 
         } else {
@@ -260,7 +260,7 @@ class BluetoothTransmitter: NSObject, CBCentralManagerDelegate, CBPeripheralDele
         heartbeat()
 
         if let error = error {
-            debug(.deviceManager, "    error: \(error.localizedDescription)")
+            debug(.deviceManager, "    error: \(error)")
         }
 
         // if self.peripheral == nil, then a manual disconnect or something like that has occured, no need to reconnect
@@ -279,7 +279,7 @@ class BluetoothTransmitter: NSObject, CBCentralManagerDelegate, CBPeripheralDele
         debug(.deviceManager, "didDiscoverServices for peripheral with name \(peripheral.name ?? "'unknown'")")
 
         if let error = error {
-            debug(.deviceManager, "    didDiscoverServices error: \(error.localizedDescription)")
+            debug(.deviceManager, "    didDiscoverServices error: \(error)")
         }
 
         if let services = peripheral.services {
@@ -302,7 +302,7 @@ class BluetoothTransmitter: NSObject, CBCentralManagerDelegate, CBPeripheralDele
         )
 
         if let error = error {
-            debug(.deviceManager, "    didDiscoverCharacteristicsFor error: \(error.localizedDescription)")
+            debug(.deviceManager, "    didDiscoverCharacteristicsFor error: \(error)")
         }
 
         if let characteristics = service.characteristics {
@@ -327,7 +327,7 @@ class BluetoothTransmitter: NSObject, CBCentralManagerDelegate, CBPeripheralDele
         if let error = error {
             debug(
                 .deviceManager,
-                "didUpdateNotificationStateFor for peripheral with name \(peripheral.name ?? "'unkonwn'"), characteristic \(String(describing: characteristic.uuid)), error =  \(error.localizedDescription)"
+                "didUpdateNotificationStateFor for peripheral with name \(peripheral.name ?? "'unkonwn'"), characteristic \(String(describing: characteristic.uuid)), error =  \(error)"
             )
         }
     }

+ 2 - 2
Trio/Sources/APS/DeviceDataManager.swift

@@ -499,7 +499,7 @@ extension BaseDeviceDataManager: PumpManagerDelegate {
 
     func pumpManager(_: PumpManager, didError error: PumpManagerError) {
         dispatchPrecondition(condition: .onQueue(processQueue))
-        debug(.deviceManager, "error: \(error.localizedDescription), reason: \(String(describing: error.failureReason))")
+        debug(.deviceManager, "error: \(error), reason: \(String(describing: error.failureReason))")
         errorSubject.send(error)
     }
 
@@ -675,7 +675,7 @@ extension BaseDeviceDataManager: AlertObserver {
             self.pumpManager?.acknowledgeAlert(alertIdentifier: alert.alertIdentifier) { error in
                 if let error = error {
                     self.alertHistoryStorage.ackAlert(alertIssueDate, error.localizedDescription)
-                    debug(.deviceManager, "acknowledge not succeeded with error \(error.localizedDescription)")
+                    debug(.deviceManager, "acknowledge not succeeded with error \(error)")
                 } else {
                     self.alertHistoryStorage.ackAlert(alertIssueDate, nil)
                 }

+ 1 - 1
Trio/Sources/APS/FetchGlucoseManager.swift

@@ -102,7 +102,7 @@ final class BaseFetchGlucoseManager: FetchGlucoseManager, Injectable {
                                 glucose: newGlucose
                             )
                         } catch {
-                            debug(.deviceManager, "Failed to store glucose: \(error.localizedDescription)")
+                            debug(.deviceManager, "Failed to store glucose: \(error)")
                         }
                     }
                 }

+ 1 - 1
Trio/Sources/APS/Storage/CarbsStorage.swift

@@ -334,7 +334,7 @@ final class BaseCarbsStorage: CarbsStorage, Injectable {
                 }
 
             } catch {
-                debugPrint("\(DebuggingIdentifiers.failed) Error deleting carb entry: \(error.localizedDescription)")
+                debugPrint("\(DebuggingIdentifiers.failed) Error deleting carb entry: \(error)")
             }
         }
     }

+ 1 - 1
Trio/Sources/APS/Storage/ContactImageStorage.swift

@@ -61,7 +61,7 @@ final class BaseContactImageStorage: ContactImageStorage, Injectable {
                 }
             }
         } catch {
-            debug(.default, "\(DebuggingIdentifiers.failed) Error fetching contact image entries: \(error.localizedDescription)")
+            debug(.default, "\(DebuggingIdentifiers.failed) Error fetching contact image entries: \(error)")
             return []
         }
     }

+ 4 - 4
Trio/Sources/APS/Storage/DeterminationStorage.swift

@@ -55,7 +55,7 @@ final class BaseDeterminationStorage: DeterminationStorage, Injectable {
                 return forecasts.map(\.objectID) as [NSManagedObjectID]
             } catch {
                 debugPrint(
-                    "Failed \(DebuggingIdentifiers.failed) to fetch Forecast IDs for OrefDetermination with ID \(determinationID): \(error.localizedDescription)"
+                    "Failed \(DebuggingIdentifiers.failed) to fetch Forecast IDs for OrefDetermination with ID \(determinationID): \(error)"
                 )
                 return []
             }
@@ -74,7 +74,7 @@ final class BaseDeterminationStorage: DeterminationStorage, Injectable {
                 return forecastValues.map(\.objectID)
             } catch {
                 debugPrint(
-                    "Failed \(DebuggingIdentifiers.failed) to fetch Forecast Value IDs with ID \(forecastID): \(error.localizedDescription)"
+                    "Failed \(DebuggingIdentifiers.failed) to fetch Forecast Value IDs with ID \(forecastID): \(error)"
                 )
                 return []
             }
@@ -102,7 +102,7 @@ final class BaseDeterminationStorage: DeterminationStorage, Injectable {
                 }
             } catch {
                 debugPrint(
-                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch forecast Values with error: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch forecast Values with error: \(error)"
                 )
             }
             return (data.id, forecast, forecastValues)
@@ -196,7 +196,7 @@ final class BaseDeterminationStorage: DeterminationStorage, Injectable {
                 }
             } catch {
                 debugPrint(
-                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch managed object with error: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch managed object with error: \(error)"
                 )
             }
 

+ 2 - 2
Trio/Sources/APS/Storage/GlucoseStorage.swift

@@ -268,7 +268,7 @@ final class BaseGlucoseStorage: GlucoseStorage, Injectable {
                     fetchedDate = date
                 }
             } catch {
-                debugPrint("Fetch error: \(DebuggingIdentifiers.failed) \(error.localizedDescription)")
+                debugPrint("Fetch error: \(DebuggingIdentifiers.failed) \(error)")
             }
         }
 
@@ -568,7 +568,7 @@ final class BaseGlucoseStorage: GlucoseStorage, Injectable {
                 debugPrint("\(#file) \(#function) \(DebuggingIdentifiers.succeeded) deleted glucose from core data")
             } catch {
                 debugPrint(
-                    "\(#file) \(#function) \(DebuggingIdentifiers.failed) error while deleting glucose from core data: \(error.localizedDescription)"
+                    "\(#file) \(#function) \(DebuggingIdentifiers.failed) error while deleting glucose from core data: \(error)"
                 )
             }
         }

+ 1 - 1
Trio/Sources/APS/Storage/OverrideStorage.swift

@@ -232,7 +232,7 @@ final class BaseOverrideStorage: @preconcurrency OverrideStorage, Injectable {
                     "OverrideStorage: \(#function) \(DebuggingIdentifiers.succeeded) deleted override from core data"
                 )
             } catch {
-                debugPrint("\(DebuggingIdentifiers.failed) Error deleting override: \(error.localizedDescription)")
+                debugPrint("\(DebuggingIdentifiers.failed) Error deleting override: \(error)")
             }
         }
     }

+ 1 - 1
Trio/Sources/APS/Storage/TDDStorage.swift

@@ -158,7 +158,7 @@ final class BaseTDDStorage: TDDStorage, Injectable {
                 guard self.privateContext.hasChanges else { return }
                 try self.privateContext.save()
             } catch {
-                debug(.apsManager, "\(DebuggingIdentifiers.failed) Failed to save TDD: \(error.localizedDescription)")
+                debug(.apsManager, "\(DebuggingIdentifiers.failed) Failed to save TDD: \(error)")
             }
         }
     }

+ 4 - 4
Trio/Sources/Application/AppDelegate.swift

@@ -40,13 +40,13 @@ class AppDelegate: NSObject, UIApplicationDelegate, ObservableObject, UNUserNoti
                 } catch {
                     debug(
                         .default,
-                        "\(DebuggingIdentifiers.failed) failed to handle remote notification with error: \(error.localizedDescription)"
+                        "\(DebuggingIdentifiers.failed) failed to handle remote notification with error: \(error)"
                     )
                     completionHandler(.failed)
                 }
             }
         } catch {
-            debug(.remoteControl, "Error decoding push message: \(error.localizedDescription)")
+            debug(.remoteControl, "Error decoding push message: \(error)")
             completionHandler(.failed)
         }
     }
@@ -64,7 +64,7 @@ class AppDelegate: NSObject, UIApplicationDelegate, ObservableObject, UNUserNoti
             } catch {
                 debug(
                     .remoteControl,
-                    "\(DebuggingIdentifiers.failed) failed to register for remote notifications: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) failed to register for remote notifications: \(error)"
                 )
             }
         }
@@ -74,6 +74,6 @@ class AppDelegate: NSObject, UIApplicationDelegate, ObservableObject, UNUserNoti
         _: UIApplication,
         didFailToRegisterForRemoteNotificationsWithError error: Error
     ) {
-        debug(.remoteControl, "Failed to register for remote notifications: \(error.localizedDescription)")
+        debug(.remoteControl, "Failed to register for remote notifications: \(error)")
     }
 }

+ 1 - 1
Trio/Sources/Application/TrioApp.swift

@@ -162,7 +162,7 @@ extension Notification.Name {
             } catch {
                 debug(
                     .coreData,
-                    "\(DebuggingIdentifiers.failed) Failed to initialize Core Data Stack: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Failed to initialize Core Data Stack: \(error)"
                 )
 
                 await MainActor.run {

+ 2 - 2
Trio/Sources/Helpers/MainChartHelper.swift

@@ -70,7 +70,7 @@ enum MainChartHelper {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to calculate duration for object with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to calculate duration for object with error: \(error)"
             )
         }
 
@@ -85,7 +85,7 @@ enum MainChartHelper {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to calculate target for object with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to calculate target for object with error: \(error)"
             )
         }
         return nil

+ 3 - 3
Trio/Sources/Helpers/PropertyWrappers/PersistedProperty.swift

@@ -81,7 +81,7 @@ import Foundation
                 }
                 return value
             } catch {
-                debug(.storage, "❌ [PersistedProperty:\(key)] Failed to read value: \(error.localizedDescription)")
+                debug(.storage, "❌ [PersistedProperty:\(key)] Failed to read value: \(error)")
                 return nil
             }
         }
@@ -91,7 +91,7 @@ import Foundation
                     try FileManager.default.removeItem(at: storageURL)
                     debug(.storage, "[PersistedProperty:\(key)] Removed value.")
                 } catch {
-                    debug(.storage, "❌ [PersistedProperty:\(key)] Failed to remove value: \(error.localizedDescription)")
+                    debug(.storage, "❌ [PersistedProperty:\(key)] Failed to remove value: \(error)")
                 }
                 return
             }
@@ -108,7 +108,7 @@ import Foundation
 
                 debug(.storage, "✅ [PersistedProperty:\(key)] Saved value successfully.")
             } catch {
-                debug(.storage, "❌ [PersistedProperty:\(key)] Failed to write value: \(error.localizedDescription)")
+                debug(.storage, "❌ [PersistedProperty:\(key)] Failed to write value: \(error)")
             }
         }
     }

+ 9 - 9
Trio/Sources/Modules/Adjustments/AdjustmentsStateModel+Extensions/AdjustmentsStateModel+Overrides.swift

@@ -77,7 +77,7 @@ extension Adjustments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to disable active overrides: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to disable active overrides: \(error)"
             )
         }
     }
@@ -124,7 +124,7 @@ extension Adjustments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to save custom override: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to save custom override: \(error)"
             )
         }
     }
@@ -166,7 +166,7 @@ extension Adjustments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to save override preset: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to save override preset: \(error)"
             )
         }
     }
@@ -182,7 +182,7 @@ extension Adjustments.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Failed to setup override presets: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Failed to setup override presets: \(error)"
                 )
             }
         }
@@ -197,7 +197,7 @@ extension Adjustments.StateModel {
             overridePresets = overrideObjects
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to extract Overrides: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to extract Overrides: \(error)"
             )
         }
     }
@@ -211,7 +211,7 @@ extension Adjustments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to delete override preset: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to delete override preset: \(error)"
             )
         }
     }
@@ -238,7 +238,7 @@ extension Adjustments.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Failed to update override configuration: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Failed to update override configuration: \(error)"
                 )
             }
         }
@@ -274,7 +274,7 @@ extension Adjustments.StateModel {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to set active Override: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to set active Override: \(error)"
             )
         }
     }
@@ -298,7 +298,7 @@ extension Adjustments.StateModel {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to cancel previous Override: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to cancel previous Override: \(error)"
             )
         }
     }

+ 6 - 6
Trio/Sources/Modules/Adjustments/AdjustmentsStateModel+Extensions/AdjustmentsStateModel+TempTargets.swift

@@ -22,7 +22,7 @@ extension Adjustments.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to load latest temp target configuration with error: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to load latest temp target configuration with error: \(error)"
                 )
             }
         }
@@ -59,7 +59,7 @@ extension Adjustments.StateModel {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to set active preset name with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to set active preset name with error: \(error)"
             )
         }
     }
@@ -79,7 +79,7 @@ extension Adjustments.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Failed to setup temp targets: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Failed to setup temp targets: \(error)"
                 )
             }
         }
@@ -186,7 +186,7 @@ extension Adjustments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to enable scheduled temp target: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to enable scheduled temp target: \(error)"
             )
         }
     }
@@ -329,7 +329,7 @@ extension Adjustments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to disable active temp targets: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to disable active temp targets: \(error)"
             )
         }
     }
@@ -360,7 +360,7 @@ extension Adjustments.StateModel {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to cancel previous override with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to cancel previous override with error: \(error)"
             )
         }
     }

+ 1 - 1
Trio/Sources/Modules/AlgorithmAdvancedSettings/AlgorithmAdvancedSettingsStateModel.swift

@@ -74,7 +74,7 @@ extension AlgorithmAdvancedSettings {
                             } catch {
                                 debug(
                                     .default,
-                                    "\(DebuggingIdentifiers.failed) failed to upload DIA to Nightscout: \(error.localizedDescription)"
+                                    "\(DebuggingIdentifiers.failed) failed to upload DIA to Nightscout: \(error)"
                                 )
                             }
                         }

+ 2 - 2
Trio/Sources/Modules/AutosensSettings/AutosensSettingsStateModel.swift

@@ -49,7 +49,7 @@ extension AutosensSettings {
                 } catch {
                     debug(
                         .default,
-                        "\(DebuggingIdentifiers.failed) Error fetching determination IDs: \(error.localizedDescription)"
+                        "\(DebuggingIdentifiers.failed) Error fetching determination IDs: \(error)"
                     )
                 }
             }
@@ -64,7 +64,7 @@ extension AutosensSettings {
 
             } catch {
                 debugPrint(
-                    "Home State: \(#function) \(DebuggingIdentifiers.failed) error while updating the glucose array: \(error.localizedDescription)"
+                    "Home State: \(#function) \(DebuggingIdentifiers.failed) error while updating the glucose array: \(error)"
                 )
             }
         }

+ 1 - 1
Trio/Sources/Modules/BasalProfileEditor/BasalProfileEditorStateModel.swift

@@ -98,7 +98,7 @@ extension BasalProfileEditor {
                                 debug(.nightscout, "Attempting to upload basal rates to Nightscout")
                                 try await self.nightscout.uploadProfiles()
                             } catch {
-                                debug(.default, "Failed to upload basal rates to Nightscout: \(error.localizedDescription)")
+                                debug(.default, "Failed to upload basal rates to Nightscout: \(error)")
                             }
                         }
                     case .failure:

+ 1 - 1
Trio/Sources/Modules/Calibrations/CalibrationsStateModel.swift

@@ -81,7 +81,7 @@ extension Calibrations {
                     return
                 }
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) Failed to add calibration: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) Failed to add calibration: \(error)")
             }
         }
 

+ 1 - 1
Trio/Sources/Modules/CarbRatioEditor/CarbRatioEditorStateModel.swift

@@ -74,7 +74,7 @@ extension CarbRatioEditor {
                     debug(.nightscout, "Attempting to upload CRs to Nightscout")
                     try await self.nightscout.uploadProfiles()
                 } catch {
-                    debug(.default, "Failed to upload CRs to Nightscout: \(error.localizedDescription)")
+                    debug(.default, "Failed to upload CRs to Nightscout: \(error)")
                 }
             }
         }

+ 7 - 7
Trio/Sources/Modules/DataTable/DataTableStateModel.swift

@@ -87,7 +87,7 @@ extension DataTable {
                     )
                 } catch {
                     debugPrint(
-                        "\(#file) \(#function) \(DebuggingIdentifiers.failed) error while deleting glucose remote service(s) (Nightscout, Apple Health, Tidepool) with error: \(error.localizedDescription)"
+                        "\(#file) \(#function) \(DebuggingIdentifiers.failed) error while deleting glucose remote service(s) (Nightscout, Apple Health, Tidepool) with error: \(error)"
                     )
                 }
             }
@@ -116,7 +116,7 @@ extension DataTable {
                     try await deleteCarbs(treatmentObjectID, isFpuOrComplexMeal: isFpuOrComplexMeal)
 
                 } catch {
-                    debug(.default, "\(DebuggingIdentifiers.failed) Failed to delete carbs: \(error.localizedDescription)")
+                    debug(.default, "\(DebuggingIdentifiers.failed) Failed to delete carbs: \(error)")
                     await MainActor.run {
                         carbEntryDeleted = false
                         waitForSuggestion = false
@@ -210,7 +210,7 @@ extension DataTable {
                         )
                     }
                 } catch {
-                    debugPrint("\(DebuggingIdentifiers.failed) Error deleting entries: \(error.localizedDescription)")
+                    debugPrint("\(DebuggingIdentifiers.failed) Error deleting entries: \(error)")
                 }
             }
         }
@@ -256,7 +256,7 @@ extension DataTable {
                 try await apsManager.determineBasalSync()
             } catch {
                 debugPrint(
-                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Error while Insulin Deletion Task: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Error while Insulin Deletion Task: \(error)"
                 )
                 await MainActor.run {
                     insulinEntryDeleted = false
@@ -291,7 +291,7 @@ extension DataTable {
 
                     debug(.default, "Successfully deleted the treatment object.")
                 } catch {
-                    debug(.default, "Failed to delete the treatment object: \(error.localizedDescription)")
+                    debug(.default, "Failed to delete the treatment object: \(error)")
                 }
             }
         }
@@ -343,7 +343,7 @@ extension DataTable {
                     try await apsManager.determineBasalSync()
 
                 } catch {
-                    debug(.default, "\(DebuggingIdentifiers.failed) failed to update entry: \(error.localizedDescription)")
+                    debug(.default, "\(DebuggingIdentifiers.failed) failed to update entry: \(error)")
                 }
             }
         }
@@ -470,7 +470,7 @@ extension DataTable {
                         date: entryDate
                     )
                 } catch {
-                    debugPrint("\(DebuggingIdentifiers.failed) Failed to load entry: \(error.localizedDescription)")
+                    debugPrint("\(DebuggingIdentifiers.failed) Failed to load entry: \(error)")
                     return nil
                 }
             }

+ 1 - 1
Trio/Sources/Modules/Home/HomeStateModel+Setup/BatterySetup.swift

@@ -12,7 +12,7 @@ extension Home.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up battery array: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up battery array: \(error)"
                 )
             }
         }

+ 1 - 1
Trio/Sources/Modules/Home/HomeStateModel+Setup/CurrentTDDSetup.swift

@@ -11,7 +11,7 @@ extension Home.StateModel {
                 // Get the NSManagedObjects and map them to TDD on the Main Thread
                 try await updateTDDArray(with: tddObjectIds, keyPath: \.fetchedTDDs)
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) failed to fetch TDDs: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) failed to fetch TDDs: \(error)")
             }
         }
     }

+ 2 - 2
Trio/Sources/Modules/Home/HomeStateModel+Setup/DeterminationSetup.swift

@@ -19,9 +19,9 @@ extension Home.StateModel {
 
                 await updateForecastData()
             } catch let error as CoreDataError {
-                debug(.default, "Core Data error in setupDeterminationsArray: \(error.localizedDescription)")
+                debug(.default, "Core Data error in setupDeterminationsArray: \(error)")
             } catch {
-                debug(.default, "Unexpected error in setupDeterminationsArray: \(error.localizedDescription)")
+                debug(.default, "Unexpected error in setupDeterminationsArray: \(error)")
             }
         }
     }

+ 1 - 1
Trio/Sources/Modules/Home/HomeStateModel+Setup/ForecastSetup.swift

@@ -23,7 +23,7 @@ extension Home.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to preprocess forecast data: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to preprocess forecast data: \(error)"
             )
             return []
         }

+ 1 - 1
Trio/Sources/Modules/Home/HomeStateModel+Setup/GlucoseSetup.swift

@@ -12,7 +12,7 @@ extension Home.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up glucose array: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up glucose array: \(error)"
                 )
             }
         }

+ 4 - 4
Trio/Sources/Modules/Home/HomeStateModel+Setup/OverrideSetup.swift

@@ -11,9 +11,9 @@ extension Home.StateModel {
                     .getNSManagedObject(with: ids, context: viewContext)
                 await updateOverrideArray(with: overrideObjects)
             } catch let error as CoreDataError {
-                debug(.default, "Core Data error in setupOverrides: \(error.localizedDescription)")
+                debug(.default, "Core Data error in setupOverrides: \(error)")
             } catch {
-                debug(.default, "Unexpected error in setupOverrides: \(error.localizedDescription)")
+                debug(.default, "Unexpected error in setupOverrides: \(error)")
             }
         }
     }
@@ -55,9 +55,9 @@ extension Home.StateModel {
                     .getNSManagedObject(with: ids, context: viewContext)
                 await updateOverrideRunStoredArray(with: overrideRunObjects)
             } catch let error as CoreDataError {
-                debug(.default, "Core Data error in setupOverrideRunStored: \(error.localizedDescription)")
+                debug(.default, "Core Data error in setupOverrideRunStored: \(error)")
             } catch {
-                debug(.default, "Unexpected error in setupOverrideRunStored: \(error.localizedDescription)")
+                debug(.default, "Unexpected error in setupOverrideRunStored: \(error)")
             }
         }
     }

+ 3 - 3
Trio/Sources/Modules/Home/HomeStateModel+Setup/PumpHistorySetup.swift

@@ -12,7 +12,7 @@ extension Home.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up insulin array: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up insulin array: \(error)"
                 )
             }
         }
@@ -62,7 +62,7 @@ extension Home.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up last bolus: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up last bolus: \(error)"
                 )
             }
         }
@@ -92,7 +92,7 @@ extension Home.StateModel {
             lastPumpBolus = try viewContext.existingObject(with: ID) as? PumpEventStored
         } catch {
             debugPrint(
-                "Home State: \(#function) \(DebuggingIdentifiers.failed) error while updating the insulin array: \(error.localizedDescription)"
+                "Home State: \(#function) \(DebuggingIdentifiers.failed) error while updating the insulin array: \(error)"
             )
         }
     }

+ 2 - 2
Trio/Sources/Modules/Home/HomeStateModel+Setup/TempTargetSetup.swift

@@ -12,7 +12,7 @@ extension Home.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up tempTargetStored: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up tempTargetStored: \(error)"
                 )
             }
         }
@@ -50,7 +50,7 @@ extension Home.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up temp targetsRunStored: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up temp targetsRunStored: \(error)"
                 )
             }
         }

+ 1 - 1
Trio/Sources/Modules/Home/HomeStateModel.swift

@@ -335,7 +335,7 @@ extension Home {
                 .map { [weak self] error in
                     self?.errorDate = error == nil ? nil : Date()
                     if let error = error {
-                        info(.default, error.localizedDescription)
+                        info(.default, error)
                     }
                     return error?.localizedDescription
                 }

+ 1 - 1
Trio/Sources/Modules/ISFEditor/ISFEditorStateModel.swift

@@ -105,7 +105,7 @@ extension ISFEditor {
                 } catch {
                     debug(
                         .default,
-                        "\(DebuggingIdentifiers.failed) Faile to upload ISF to Nightscout: \(error.localizedDescription)"
+                        "\(DebuggingIdentifiers.failed) Faile to upload ISF to Nightscout: \(error)"
                     )
                 }
             }

+ 3 - 3
Trio/Sources/Modules/NightscoutConfig/NightscoutConfigStateModel.swift

@@ -63,7 +63,7 @@ extension NightscoutConfig {
                             } catch {
                                 debug(
                                     .default,
-                                    "\(DebuggingIdentifiers.failed) failed to upload profiles: \(error.localizedDescription)"
+                                    "\(DebuggingIdentifiers.failed) failed to upload profiles: \(error)"
                                 )
                             }
                         }
@@ -152,10 +152,10 @@ extension NightscoutConfig {
                         await self.healthKitManager.uploadGlucose()
                     }
                 } catch let error as CoreDataError {
-                    debug(.nightscout, "Core Data error while storing backfilled glucose: \(error.localizedDescription)")
+                    debug(.nightscout, "Core Data error while storing backfilled glucose: \(error)")
                     message = "Error: \(error.localizedDescription)"
                 } catch {
-                    debug(.nightscout, "Unexpected error while storing backfilled glucose: \(error.localizedDescription)")
+                    debug(.nightscout, "Unexpected error while storing backfilled glucose: \(error)")
                     message = "Error: \(error.localizedDescription)"
                 }
             } else {

+ 1 - 1
Trio/Sources/Modules/Onboarding/OnboardingStateModel+Nightscout.swift

@@ -165,7 +165,7 @@ extension Onboarding.StateModel {
             await MainActor.run {
                 self.nightscoutImportError = NightscoutImportError(message: error.localizedDescription)
                 self.nightscoutImportStatus = .failed
-                debug(.service, "Settings import failed with error: \(error.localizedDescription)")
+                debug(.service, "Settings import failed with error: \(error)")
             }
         }
     }

+ 1 - 1
Trio/Sources/Modules/Stat/StatStateModel+Setup/BolusStatsSetup.swift

@@ -34,7 +34,7 @@ extension Stat.StateModel {
                 // Initially calculate and cache daily averages
                 await calculateAndCacheBolusAveragesAndTotals()
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) failed to setup bolus stats: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) failed to setup bolus stats: \(error)")
             }
         }
     }

+ 1 - 1
Trio/Sources/Modules/Stat/StatStateModel+Setup/LoopChartSetup.swift

@@ -70,7 +70,7 @@ extension Stat.StateModel {
                     self.loopStats = stats
                 }
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) failed to fetch loop stats: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) failed to fetch loop stats: \(error)")
             }
         }
     }

+ 1 - 1
Trio/Sources/Modules/Stat/StatStateModel+Setup/TDDSetup.swift

@@ -25,7 +25,7 @@ extension Stat.StateModel {
                 // Initially calculate and cache daily averages
                 await calculateAndCacheTDDAverages()
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) failed fetching TDD stats: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) failed fetching TDD stats: \(error)")
             }
         }
     }

+ 2 - 2
Trio/Sources/Modules/Stat/StatStateModel.swift

@@ -135,7 +135,7 @@ extension Stat {
                     return fetchedResults.compactMap { $0["objectID"] as? NSManagedObjectID }
                 }
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) Error fetching glucose for stats: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) Error fetching glucose for stats: \(error)")
                 return []
             }
         }
@@ -148,7 +148,7 @@ extension Stat {
                 glucoseFromPersistence = glucoseObjects
             } catch {
                 debugPrint(
-                    "Home State: \(#function) \(DebuggingIdentifiers.failed) error while updating the glucose array: \(error.localizedDescription)"
+                    "Home State: \(#function) \(DebuggingIdentifiers.failed) error while updating the glucose array: \(error)"
                 )
             }
         }

+ 1 - 1
Trio/Sources/Modules/TargetsEditor/TargetsEditorStateModel.swift

@@ -89,7 +89,7 @@ extension TargetsEditor {
                 } catch {
                     debug(
                         .default,
-                        "\(DebuggingIdentifiers.failed) failed to upload targets to Nightscout: \(error.localizedDescription)"
+                        "\(DebuggingIdentifiers.failed) failed to upload targets to Nightscout: \(error)"
                     )
                 }
             }

+ 6 - 6
Trio/Sources/Modules/Treatments/TreatmentsStateModel.swift

@@ -197,7 +197,7 @@ extension Treatments {
                         try await group.waitForAll()
                     }
                 } catch let error as NSError {
-                    debug(.default, "Failed to setup bolus state concurrently: \(error.localizedDescription)")
+                    debug(.default, "Failed to setup bolus state concurrently: \(error)")
                 }
             }
         }
@@ -553,7 +553,7 @@ extension Treatments {
                     try await apsManager.determineBasalSync()
                 }
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) Failed to save carbs: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) Failed to save carbs: \(error)")
             }
         }
 
@@ -669,7 +669,7 @@ extension Treatments.StateModel {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Error setting up glucose array: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Error setting up glucose array: \(error)"
                 )
             }
         }
@@ -737,9 +737,9 @@ extension Treatments.StateModel {
 
             updateDeterminationsArray(with: determinationObjects)
         } catch let error as CoreDataError {
-            debug(.default, "Core Data error: \(error.localizedDescription)")
+            debug(.default, "Core Data error: \(error)")
         } catch {
-            debug(.default, "Unexpected error: \(error.localizedDescription)")
+            debug(.default, "Unexpected error: \(error)")
         }
     }
 
@@ -788,7 +788,7 @@ extension Treatments.StateModel {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Error mapping forecasts for chart: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error mapping forecasts for chart: \(error)"
             )
             return nil
         }

+ 2 - 2
Trio/Sources/Services/BolusCalculator/BolusCalculationManager.swift

@@ -361,7 +361,7 @@ final class BaseBolusCalculationManager: BolusCalculationManager, Injectable {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Error preparing calculation input: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error preparing calculation input: \(error)"
             )
             // Return default values in case of error
             throw error
@@ -504,7 +504,7 @@ final class BaseBolusCalculationManager: BolusCalculationManager, Injectable {
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Error in bolus calculation: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error in bolus calculation: \(error)"
             )
             // Return safe default values
             return CalculationResult(

+ 1 - 1
Trio/Sources/Services/Calendar/CalendarManager.swift

@@ -307,7 +307,7 @@ final class BaseCalendarManager: CalendarManager, Injectable {
 
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to create calendar event: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to create calendar event: \(error)"
             )
         }
     }

+ 7 - 7
Trio/Sources/Services/HealthKit/HealthKitManager.swift

@@ -165,7 +165,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable {
         } catch {
             debug(
                 .service,
-                "\(DebuggingIdentifiers.failed) Error fetching glucose for health upload: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error fetching glucose for health upload: \(error)"
             )
         }
     }
@@ -209,7 +209,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable {
             await updateGlucoseAsUploaded(glucose)
 
         } catch {
-            debug(.service, "Failed to upload glucose samples to HealthKit: \(error.localizedDescription)")
+            debug(.service, "Failed to upload glucose samples to HealthKit: \(error)")
         }
     }
 
@@ -244,7 +244,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable {
         } catch {
             debug(
                 .service,
-                "\(DebuggingIdentifiers.failed) Error fetching carbs for health upload: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error fetching carbs for health upload: \(error)"
             )
         }
     }
@@ -330,7 +330,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable {
             await updateCarbsAsUploaded(carbs)
 
         } catch {
-            debug(.service, "Failed to upload carb samples to HealthKit: \(error.localizedDescription)")
+            debug(.service, "Failed to upload carb samples to HealthKit: \(error)")
         }
     }
 
@@ -365,7 +365,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable {
         } catch {
             debug(
                 .service,
-                "\(DebuggingIdentifiers.failed) Error fetching insulin events for health upload: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error fetching insulin events for health upload: \(error)"
             )
         }
     }
@@ -458,10 +458,10 @@ final class BaseHealthKitManager: HealthKitManager, Injectable {
                 debug(.service, "Successfully stored \(insulinSamples.count) insulin samples in HealthKit.")
                 await updateInsulinAsUploaded(insulinEvents)
             } catch {
-                debug(.service, "Failed to upload insulin samples to HealthKit: \(error.localizedDescription)")
+                debug(.service, "Failed to upload insulin samples to HealthKit: \(error)")
             }
         } catch {
-            debug(.service, "\(DebuggingIdentifiers.failed) Error fetching temp basal entries: \(error.localizedDescription)")
+            debug(.service, "\(DebuggingIdentifiers.failed) Error fetching temp basal entries: \(error)")
         }
     }
 

+ 2 - 2
Trio/Sources/Services/LiveActivity/LiveActivityManager.swift

@@ -167,7 +167,7 @@ final class LiveActivityManager: Injectable, ObservableObject, SettingsObserver
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) failed to fetch and map determination: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) failed to fetch and map determination: \(error)"
                 )
             }
         }
@@ -182,7 +182,7 @@ final class LiveActivityManager: Injectable, ObservableObject, SettingsObserver
                     await self.updateContentState(determination)
                 }
             } catch {
-                debug(.default, "\(DebuggingIdentifiers.failed) failed to fetch and map override: \(error.localizedDescription)")
+                debug(.default, "\(DebuggingIdentifiers.failed) failed to fetch and map override: \(error)")
             }
         }
     }

+ 9 - 9
Trio/Sources/Services/Network/Nightscout/NightscoutAPI.swift

@@ -93,7 +93,7 @@ extension NightscoutAPI {
                 return reading
             }
         } catch {
-            warning(.nightscout, "Glucose fetching error: \(error.localizedDescription)")
+            warning(.nightscout, "Glucose fetching error: \(error)")
             return []
         }
     }
@@ -141,7 +141,7 @@ extension NightscoutAPI {
             let carbs = try JSONCoding.decoder.decode([CarbsEntry].self, from: data)
             return carbs
         } catch {
-            warning(.nightscout, "Carbs fetching error: \(error.localizedDescription)")
+            warning(.nightscout, "Carbs fetching error: \(error)")
             throw error
         }
     }
@@ -281,7 +281,7 @@ extension NightscoutAPI {
             let tempTargets = try JSONCoding.decoder.decode([TempTarget].self, from: data)
             return tempTargets
         } catch {
-            warning(.nightscout, "TempTarget fetching error: \(error.localizedDescription)")
+            warning(.nightscout, "TempTarget fetching error: \(error)")
             throw error
         }
     }
@@ -312,7 +312,7 @@ extension NightscoutAPI {
 //            debugPrint("Payload treatments size: \(encodedBody.count) bytes")
 //            debugPrint(String(data: encodedBody, encoding: .utf8) ?? "Invalid payload")
         } catch {
-            debugPrint("Error encoding payload: \(error.localizedDescription)")
+            debugPrint("Error encoding payload: \(error)")
             throw error
         }
         request.httpMethod = "POST"
@@ -348,7 +348,7 @@ extension NightscoutAPI {
 //            debugPrint("Payload glucose size: \(encodedBody.count) bytes")
 //            debugPrint(String(data: encodedBody, encoding: .utf8) ?? "Invalid payload")
         } catch {
-            debugPrint("Error encoding payload: \(error.localizedDescription)")
+            debugPrint("Error encoding payload: \(error)")
             throw error
         }
         request.httpMethod = "POST"
@@ -385,7 +385,7 @@ extension NightscoutAPI {
 //            debugPrint("Payload status size: \(encodedBody.count) bytes")
 //            debugPrint(String(data: encodedBody, encoding: .utf8) ?? "Invalid payload")
         } catch {
-            debugPrint("Error encoding payload: \(error.localizedDescription)")
+            debugPrint("Error encoding payload: \(error)")
             throw error
         }
 
@@ -424,7 +424,7 @@ extension NightscoutAPI {
 //            debugPrint("Payload profile upload size: \(encodedBody.count) bytes")
 //            debugPrint(String(data: encodedBody, encoding: .utf8) ?? "Invalid payload")
         } catch {
-            debugPrint("Error encoding payload: \(error.localizedDescription)")
+            debugPrint("Error encoding payload: \(error)")
             throw error
         }
         request.httpMethod = "POST"
@@ -489,7 +489,7 @@ extension NightscoutAPI {
 //            debugPrint("Payload glucose size: \(encodedBody.count) bytes")
 //            debugPrint(String(data: encodedBody, encoding: .utf8) ?? "Invalid payload")
         } catch {
-            debugPrint("Error encoding payload: \(error.localizedDescription)")
+            debugPrint("Error encoding payload: \(error)")
             throw error
         }
         request.httpMethod = "POST"
@@ -546,7 +546,7 @@ extension NightscoutAPI {
 
             return fetchedProfile
         } catch {
-            warning(.nightscout, "Could not fetch Nightscout Profile! Error: \(error.localizedDescription)")
+            warning(.nightscout, "Could not fetch Nightscout Profile! Error: \(error)")
             throw error
         }
     }

+ 24 - 24
Trio/Sources/Services/Network/Nightscout/NightscoutManager.swift

@@ -115,7 +115,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) failed to fetch last enacted determination: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) failed to fetch last enacted determination: \(error)"
                 )
             }
         }
@@ -398,7 +398,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
             let carbs = try await nightscout.fetchCarbs(sinceDate: since)
             return carbs
         } catch {
-            debug(.nightscout, "Error fetching carbs: \(error.localizedDescription)")
+            debug(.nightscout, "Error fetching carbs: \(error)")
             return []
         }
     }
@@ -413,7 +413,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
             let tempTargets = try await nightscout.fetchTempTargets(sinceDate: since)
             return tempTargets
         } catch {
-            debug(.nightscout, "Error fetching temp targets: \(error.localizedDescription)")
+            debug(.nightscout, "Error fetching temp targets: \(error)")
             return []
         }
     }
@@ -427,7 +427,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) Failed to delete Carbs from Nightscout with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to delete Carbs from Nightscout with error: \(error)"
             )
         }
     }
@@ -441,7 +441,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) Failed to delete Insulin from Nightscout with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to delete Insulin from Nightscout with error: \(error)"
             )
         }
     }
@@ -454,7 +454,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) Failed to delete Manual Glucose from Nightscout with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to delete Manual Glucose from Nightscout with error: \(error)"
             )
         }
     }
@@ -662,7 +662,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
                 self.lastSuggestedDetermination = lastSuggestedDetermination
             }
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
 
         Task.detached {
@@ -851,7 +851,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
                 debug(.nightscout, "Profile uploaded")
             } catch {
-                debug(.nightscout, "NightscoutManager uploadProfile: \(error.localizedDescription)")
+                debug(.nightscout, "NightscoutManager uploadProfile: \(error)")
                 throw error
             }
         } else {
@@ -868,7 +868,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         do {
             return try await nightscout.importSettings()
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
             return nil
         }
     }
@@ -880,7 +880,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) failed to upload glucose with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) failed to upload glucose with error: \(error)"
             )
         }
     }
@@ -891,7 +891,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) failed to upload manual glucose with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) failed to upload manual glucose with error: \(error)"
             )
         }
     }
@@ -902,7 +902,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) failed to upload pump history with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) failed to upload pump history with error: \(error)"
             )
         }
     }
@@ -914,7 +914,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) failed to upload carbs with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) failed to upload carbs with error: \(error)"
             )
         }
     }
@@ -926,7 +926,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) failed to upload overrides with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) failed to upload overrides with error: \(error)"
             )
         }
     }
@@ -938,7 +938,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
         } catch {
             debug(
                 .nightscout,
-                "\(DebuggingIdentifiers.failed) failed to upload temp targets with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) failed to upload temp targets with error: \(error)"
             )
         }
     }
@@ -959,7 +959,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Glucose uploaded")
         } catch {
-            debug(.nightscout, "Upload of glucose failed: \(error.localizedDescription)")
+            debug(.nightscout, "Upload of glucose failed: \(error)")
         }
     }
 
@@ -997,7 +997,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Treatments uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1015,7 +1015,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Treatments uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1056,7 +1056,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Treatments uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1097,7 +1097,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Treatments uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1156,7 +1156,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Overrides uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1214,7 +1214,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Overrides uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1255,7 +1255,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Temp Targets uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 
@@ -1296,7 +1296,7 @@ final class BaseNightscoutManager: NightscoutManager, Injectable {
 
             debug(.nightscout, "Temp Target Runs uploaded")
         } catch {
-            debug(.nightscout, error.localizedDescription)
+            debug(.nightscout, error)
         }
     }
 

+ 4 - 4
Trio/Sources/Services/Network/TidepoolManager.swift

@@ -191,7 +191,7 @@ extension BaseTidepoolManager {
         do {
             try uploadCarbs(await carbsStorage.getCarbsNotYetUploadedToTidepool())
         } catch {
-            debug(.service, "\(DebuggingIdentifiers.failed) Failed to upload carbs with error: \(error.localizedDescription)")
+            debug(.service, "\(DebuggingIdentifiers.failed) Failed to upload carbs with error: \(error)")
         }
     }
 
@@ -283,7 +283,7 @@ extension BaseTidepoolManager {
             let events = try await pumpHistoryStorage.getPumpHistoryNotYetUploadedToTidepool()
             await uploadDose(events)
         } catch {
-            debug(.service, "Error fetching pump history: \(error.localizedDescription)")
+            debug(.service, "Error fetching pump history: \(error)")
         }
     }
 
@@ -401,7 +401,7 @@ extension BaseTidepoolManager {
                 }
             }
         } catch {
-            debug(.service, "Error fetching temp basal entries: \(error.localizedDescription)")
+            debug(.service, "Error fetching temp basal entries: \(error)")
         }
     }
 
@@ -596,7 +596,7 @@ extension BaseTidepoolManager {
             let manualGlucose = try await glucoseStorage.getManualGlucoseNotYetUploadedToTidepool()
             uploadGlucose(manualGlucose)
         } catch {
-            debug(.service, "Error fetching glucose data: \(error.localizedDescription)")
+            debug(.service, "Error fetching glucose data: \(error)")
         }
     }
 

+ 3 - 3
Trio/Sources/Services/RemoteControl/TrioRemoteControl+Override.swift

@@ -35,7 +35,7 @@ extension TrioRemoteControl {
         } catch {
             debug(
                 .remoteControl,
-                "\(DebuggingIdentifiers.failed) Failed to handle start override command: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to handle start override command: \(error)"
             )
             await logError(
                 "Command failed: \(error.localizedDescription)",
@@ -61,7 +61,7 @@ extension TrioRemoteControl {
                 debug(.remoteControl, "Remote command processed successfully. \(pushMessage.humanReadableDescription())")
             }
         } catch {
-            debug(.remoteControl, "Failed to enact override preset: \(error.localizedDescription)")
+            debug(.remoteControl, "Failed to enact override preset: \(error)")
         }
     }
 
@@ -111,7 +111,7 @@ extension TrioRemoteControl {
         } catch {
             debug(
                 .remoteControl,
-                "\(DebuggingIdentifiers.failed) Failed to disable active overrides: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to disable active overrides: \(error)"
             )
         }
     }

+ 1 - 1
Trio/Sources/Services/RemoteControl/TrioRemoteControl+TempTarget.swift

@@ -94,7 +94,7 @@ extension TrioRemoteControl {
         } catch {
             debug(
                 .remoteControl,
-                "\(DebuggingIdentifiers.failed) Failed to disable active temp targets: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to disable active temp targets: \(error)"
             )
             await logError("Failed to disable temp targets: \(error.localizedDescription)")
         }

+ 11 - 11
Trio/Sources/Services/Storage/FileStorage.swift

@@ -30,7 +30,7 @@ final class BaseFileStorage: FileStorage {
                     try Disk.save(value, to: .documents, as: name, encoder: JSONCoding.encoder)
                 }
             } catch {
-                debug(.storage, "Failed to save file '\(name)': \(error.localizedDescription)")
+                debug(.storage, "Failed to save file '\(name)': \(error)")
             }
         }
     }
@@ -45,7 +45,7 @@ final class BaseFileStorage: FileStorage {
                         try Disk.save(value, to: .documents, as: name, encoder: JSONCoding.encoder)
                     }
                 } catch {
-                    debug(.storage, "Failed to save file '\(name)': \(error.localizedDescription)")
+                    debug(.storage, "Failed to save file '\(name)': \(error)")
                 }
                 continuation.resume()
             }
@@ -57,7 +57,7 @@ final class BaseFileStorage: FileStorage {
             do {
                 return try Disk.retrieve(name, from: .documents, as: type, decoder: JSONCoding.decoder)
             } catch {
-                debug(.storage, "Failed to retrieve file '\(name)': \(error.localizedDescription)")
+                debug(.storage, "Failed to retrieve file '\(name)': \(error)")
                 return nil
             }
         }
@@ -70,7 +70,7 @@ final class BaseFileStorage: FileStorage {
                     let result = try Disk.retrieve(name, from: .documents, as: type, decoder: JSONCoding.decoder)
                     continuation.resume(returning: result)
                 } catch {
-                    debug(.storage, "Failed to retrieve file '\(name)': \(error.localizedDescription)")
+                    debug(.storage, "Failed to retrieve file '\(name)': \(error)")
                     continuation.resume(returning: nil)
                 }
             }
@@ -87,7 +87,7 @@ final class BaseFileStorage: FileStorage {
                 }
                 return string
             } catch {
-                debug(.storage, "Failed to retrieve file '\(name)': \(error.localizedDescription)")
+                debug(.storage, "Failed to retrieve file '\(name)': \(error)")
                 return nil
             }
         }
@@ -105,7 +105,7 @@ final class BaseFileStorage: FileStorage {
                     }
                     continuation.resume(returning: string)
                 } catch {
-                    debug(.storage, "Failed to retrieve file '\(name)': \(error.localizedDescription)")
+                    debug(.storage, "Failed to retrieve file '\(name)': \(error)")
                     continuation.resume(returning: nil)
                 }
             }
@@ -117,7 +117,7 @@ final class BaseFileStorage: FileStorage {
             do {
                 try Disk.append(newValue, to: name, in: .documents, decoder: JSONCoding.decoder, encoder: JSONCoding.encoder)
             } catch {
-                debug(.storage, "Failed to append to file '\(name)': \(error.localizedDescription)")
+                debug(.storage, "Failed to append to file '\(name)': \(error)")
             }
         }
     }
@@ -127,7 +127,7 @@ final class BaseFileStorage: FileStorage {
             do {
                 try Disk.append(newValues, to: name, in: .documents, decoder: JSONCoding.decoder, encoder: JSONCoding.encoder)
             } catch {
-                debug(.storage, "Failed to append to file '\(name)': \(error.localizedDescription)")
+                debug(.storage, "Failed to append to file '\(name)': \(error)")
             }
         }
     }
@@ -173,7 +173,7 @@ final class BaseFileStorage: FileStorage {
             do {
                 try Disk.remove(name, from: .documents)
             } catch {
-                debug(.storage, "Failed to remove file '\(name)': \(error.localizedDescription)")
+                debug(.storage, "Failed to remove file '\(name)': \(error)")
             }
         }
     }
@@ -183,7 +183,7 @@ final class BaseFileStorage: FileStorage {
             do {
                 try Disk.rename(name, in: .documents, to: newName)
             } catch {
-                debug(.storage, "Failed to rename file '\(name)' to '\(newName)': \(error.localizedDescription)")
+                debug(.storage, "Failed to rename file '\(name)' to '\(newName)': \(error)")
             }
         }
     }
@@ -198,7 +198,7 @@ final class BaseFileStorage: FileStorage {
         do {
             return try Disk.url(for: file, in: .documents)
         } catch {
-            debug(.storage, "Failed to get URL for file '\(file)': \(error.localizedDescription)")
+            debug(.storage, "Failed to get URL for file '\(file)': \(error)")
             return nil
         }
     }

+ 1 - 1
Trio/Sources/Services/UserNotifications/UserNotificationsManager.swift

@@ -326,7 +326,7 @@ final class BaseUserNotificationsManager: NSObject, UserNotificationsManager, In
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to send glucose notification with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to send glucose notification with error: \(error)"
             )
         }
     }

+ 14 - 14
Trio/Sources/Services/WatchManager/AppleWatchManager.swift

@@ -327,7 +327,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
         } catch {
             debug(
                 .watchManager,
-                "\(DebuggingIdentifiers.failed) Error setting up watch state: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error setting up watch state: \(error)"
             )
             // Return empty state in case of error
             return WatchState(date: Date())
@@ -388,7 +388,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Error getting active bolus amount: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error getting active bolus amount: \(error)"
             )
         }
     }
@@ -471,7 +471,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
         // if session is not reachable, it means it's in background -> send watchState as userInfo
         if session.isReachable {
             session.sendMessage([WatchMessageKeys.watchState: message], replyHandler: nil) { error in
-                debug(.watchManager, "❌ Error sending watch state: \(error.localizedDescription)")
+                debug(.watchManager, "❌ Error sending watch state: \(error)")
             }
             WatchStateSnapshot.saveLatestDateToDisk(state.date)
         } else {
@@ -494,7 +494,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
         ]
 
         session.sendMessage(ackMessage, replyHandler: nil) { error in
-            debug(.watchManager, "❌ Error sending acknowledgment: \(error.localizedDescription)")
+            debug(.watchManager, "❌ Error sending acknowledgment: \(error)")
         }
     }
 
@@ -502,7 +502,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
 
     func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
         if let error = error {
-            debug(.watchManager, "📱 Phone session activation failed: \(error.localizedDescription)")
+            debug(.watchManager, "📱 Phone session activation failed: \(error)")
             return
         }
 
@@ -611,9 +611,9 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                         }
 
                     } catch let error as CoreDataError {
-                        debug(.default, "Core Data error: \(error.localizedDescription)")
+                        debug(.default, "Core Data error: \(error)")
                     } catch {
-                        debug(.default, "Unexpected error: \(error.localizedDescription)")
+                        debug(.default, "Unexpected error: \(error)")
                     }
 
                     // Get recommendation from BolusCalculationManager
@@ -726,7 +726,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                         ackCode: .carbsLogged
                     )
                 } catch {
-                    debug(.watchManager, "❌ Error saving carbs: \(error.localizedDescription)")
+                    debug(.watchManager, "❌ Error saving carbs: \(error)")
 
                     // Acknowledge failure
                     self.sendAcknowledgment(toWatch: false, message: "Error logging carbs", ackCode: .genericFailure)
@@ -807,7 +807,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                 )
 
             } catch {
-                debug(.watchManager, "❌ Error processing combined request: \(error.localizedDescription)")
+                debug(.watchManager, "❌ Error processing combined request: \(error)")
                 sendAcknowledgment(toWatch: false, message: "Failed to log carbs and bolus", ackCode: .genericFailure)
             }
         }
@@ -852,7 +852,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                                 ackCode: .overrideStopped
                             )
                         } catch {
-                            debug(.watchManager, "❌ Error cancelling override: \(error.localizedDescription)")
+                            debug(.watchManager, "❌ Error cancelling override: \(error)")
                             // Acknowledge cancellation error
                             self.sendAcknowledgment(toWatch: false, message: "Error stopping Override.", ackCode: .genericFailure)
                         }
@@ -900,7 +900,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                     debug(.watchManager, "📱 Currently no override is active... proceeding to activate override: \(presetName)")
                 }
             } catch {
-                debug(.watchManager, "❌ Error while checking for active override: \(error.localizedDescription)")
+                debug(.watchManager, "❌ Error while checking for active override: \(error)")
                 self.sendAcknowledgment(
                     toWatch: false,
                     message: "Failed to load active override.",
@@ -952,7 +952,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                         ackCode: .overrideStarted
                     )
                 } catch {
-                    debug(.watchManager, "❌ Error activating override: \(error.localizedDescription)")
+                    debug(.watchManager, "❌ Error activating override: \(error)")
                     // Acknowledge activation error
                     self.sendAcknowledgment(
                         toWatch: false,
@@ -1040,7 +1040,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                             ackCode: .tempTargetStarted
                         )
                     } catch {
-                        debug(.watchManager, "❌ Error activating temp target: \(error.localizedDescription)")
+                        debug(.watchManager, "❌ Error activating temp target: \(error)")
                         // Acknowledge activation error
                         self.sendAcknowledgment(
                             toWatch: false,
@@ -1095,7 +1095,7 @@ final class BaseWatchManager: NSObject, WCSessionDelegate, Injectable, WatchMana
                                 ackCode: .tempTargetStopped
                             )
                         } catch {
-                            debug(.watchManager, "❌ Error stopping temp target: \(error.localizedDescription)")
+                            debug(.watchManager, "❌ Error stopping temp target: \(error)")
                             // Acknowledge cancellation error
                             self.sendAcknowledgment(
                                 toWatch: false,

+ 5 - 5
Trio/Sources/Services/WatchManager/GarminManager.swift

@@ -141,7 +141,7 @@ final class BaseGarminManager: NSObject, GarminManager, Injectable {
                     } catch {
                         debug(
                             .watchManager,
-                            "\(DebuggingIdentifiers.failed) Error updating watch state: \(error.localizedDescription)"
+                            "\(DebuggingIdentifiers.failed) Error updating watch state: \(error)"
                         )
                     }
                 }
@@ -168,7 +168,7 @@ final class BaseGarminManager: NSObject, GarminManager, Injectable {
                     } catch {
                         debug(
                             .watchManager,
-                            "\(DebuggingIdentifiers.failed) failed to update watch state: \(error.localizedDescription)"
+                            "\(DebuggingIdentifiers.failed) failed to update watch state: \(error)"
                         )
                     }
                 }
@@ -188,7 +188,7 @@ final class BaseGarminManager: NSObject, GarminManager, Injectable {
                     } catch {
                         debug(
                             .watchManager,
-                            "\(DebuggingIdentifiers.failed) failed to update watch state: \(error.localizedDescription)"
+                            "\(DebuggingIdentifiers.failed) failed to update watch state: \(error)"
                         )
                     }
                 }
@@ -315,7 +315,7 @@ final class BaseGarminManager: NSObject, GarminManager, Injectable {
         } catch {
             debug(
                 .watchManager,
-                "\(DebuggingIdentifiers.failed) Error setting up Garmin watch state: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error setting up Garmin watch state: \(error)"
             )
             throw error
         }
@@ -610,7 +610,7 @@ extension BaseGarminManager: SettingsObserver {
             } catch {
                 debug(
                     .watchManager,
-                    "\(DebuggingIdentifiers.failed) failed to send watch state data: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) failed to send watch state data: \(error)"
                 )
             }
         }

+ 4 - 4
Trio/Sources/Shortcuts/Override/OverridePresetsIntentRequest.swift

@@ -37,7 +37,7 @@ import UIKit
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Error fetching/processing overrides: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Error fetching/processing overrides: \(error)"
             )
             throw error
         }
@@ -72,7 +72,7 @@ import UIKit
             } catch {
                 debug(
                     .default,
-                    "\(DebuggingIdentifiers.failed) Failed to fetch Override: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) Failed to fetch Override: \(error)"
                 )
                 throw error
             }
@@ -145,7 +145,7 @@ import UIKit
         } catch {
             debug(
                 .default,
-                "\(DebuggingIdentifiers.failed) Failed to enact override: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) Failed to enact override: \(error)"
             )
             endBackgroundTaskSafely(&backgroundTaskID, taskName: "Override Enact")
             return false
@@ -231,7 +231,7 @@ import UIKit
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to disable active Overrides with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to disable active Overrides with error: \(error)"
             )
             if var backgroundTaskID = backgroundTaskID {
                 debug(.default, "Ending background task for override cancel")

+ 4 - 4
Trio/Sources/Shortcuts/TempPresets/TempPresetsIntentRequest.swift

@@ -73,7 +73,7 @@ final class TempPresetsIntentRequest: BaseIntentsRequest {
                 }
             } catch let error as NSError {
                 debugPrint(
-                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch TempTarget: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch TempTarget: \(error)"
                 )
                 return [TempPreset(id: UUID(), name: "", duration: 0)]
             }
@@ -94,7 +94,7 @@ final class TempPresetsIntentRequest: BaseIntentsRequest {
                 return try self.coredataContext.fetch(fetchRequest).first?.objectID
             } catch {
                 debugPrint(
-                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch Temp Target: \(error.localizedDescription)"
+                    "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to fetch Temp Target: \(error)"
                 )
                 return nil
             }
@@ -169,7 +169,7 @@ final class TempPresetsIntentRequest: BaseIntentsRequest {
             return intentSuccess
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to enact Temp Target with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to enact Temp Target with error: \(error)"
             )
 
             endBackgroundTaskSafely(&backgroundTaskID, taskName: "TempTarget Enact")
@@ -246,7 +246,7 @@ final class TempPresetsIntentRequest: BaseIntentsRequest {
             }
         } catch {
             debugPrint(
-                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to disable active Temp Targets with error: \(error.localizedDescription)"
+                "\(DebuggingIdentifiers.failed) \(#file) \(#function) Failed to disable active Temp Targets with error: \(error)"
             )
             if var backgroundTaskID = backgroundTaskID {
                 debug(.default, "Ending background task for temp target cancel")