Better error logging

This commit is contained in:
Shadowfacts 2022-01-26 21:22:15 -05:00
parent 1ce72b73db
commit 0d89a0f38f
3 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,7 @@ public struct ExcerptGenerator {
NSUpdatedObjectsKey: Array(updated)
], into: [fervorController.persistentContainer.viewContext])
} catch {
logger.error("Unable to save context: \(error.localizedDescription, privacy: .public)")
logger.error("Unable to save context: \(String(describing: error), privacy: .public)")
}
}
}

View File

@ -78,7 +78,7 @@ class FervorController {
let _ = try await f(item.id!)
count += 1
} catch {
logger.error("Failed to sync read state: \(error.localizedDescription, privacy: .public)")
logger.error("Failed to sync read state: \(String(describing: error), privacy: .public)")
item.needsReadStateSync = true
}
}
@ -94,7 +94,7 @@ class FervorController {
count += 1
item.needsReadStateSync = false
} catch {
logger.error("Failed to sync read state again: \(error.localizedDescription, privacy: .public)")
logger.error("Failed to sync read state again: \(String(describing: error), privacy: .public)")
item.needsReadStateSync = true
// todo: this should probably fail after a certain number of attempts
}
@ -106,7 +106,7 @@ class FervorController {
do {
try persistentContainer.viewContext.save()
} catch {
logger.error("Failed to save view context: \(error.localizedDescription, privacy: .public)")
logger.error("Failed to save view context: \(String(describing: error), privacy: .public)")
}
}
@ -118,7 +118,7 @@ class FervorController {
_ = try await f(item.id!)
item.needsReadStateSync = false
} catch {
logger.error("Failed to mark item (un)read: \(error.localizedDescription, privacy: .public)")
logger.error("Failed to mark item (un)read: \(String(describing: error), privacy: .public)")
item.needsReadStateSync = true
}
@ -126,7 +126,7 @@ class FervorController {
do {
try persistentContainer.viewContext.save()
} catch {
logger.error("Failed to save view context: \(error.localizedDescription, privacy: .public)")
logger.error("Failed to save view context: \(String(describing: error), privacy: .public)")
}
}
}

View File

@ -84,7 +84,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
do {
try await fervorController.syncReadToServer()
} catch {
logger.error("Unable to sync read state to server: \(error.localizedDescription, privacy: .public)")
logger.error("Unable to sync read state to server: \(String(describing: error), privacy: .public)")
}
}
}
@ -113,7 +113,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
do {
try await self.fervorController.syncAll()
} catch {
logger.error("Unable to sync from server: \(error.localizedDescription, privacy: .public)")
logger.error("Unable to sync from server: \(String(describing: error), privacy: .public)")
}
ExcerptGenerator.generateAll(fervorController)