Better error logging
This commit is contained in:
parent
1ce72b73db
commit
0d89a0f38f
|
@ -45,7 +45,7 @@ public struct ExcerptGenerator {
|
||||||
NSUpdatedObjectsKey: Array(updated)
|
NSUpdatedObjectsKey: Array(updated)
|
||||||
], into: [fervorController.persistentContainer.viewContext])
|
], into: [fervorController.persistentContainer.viewContext])
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Unable to save context: \(error.localizedDescription, privacy: .public)")
|
logger.error("Unable to save context: \(String(describing: error), privacy: .public)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class FervorController {
|
||||||
let _ = try await f(item.id!)
|
let _ = try await f(item.id!)
|
||||||
count += 1
|
count += 1
|
||||||
} catch {
|
} 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
|
item.needsReadStateSync = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class FervorController {
|
||||||
count += 1
|
count += 1
|
||||||
item.needsReadStateSync = false
|
item.needsReadStateSync = false
|
||||||
} catch {
|
} 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
|
item.needsReadStateSync = true
|
||||||
// todo: this should probably fail after a certain number of attempts
|
// todo: this should probably fail after a certain number of attempts
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class FervorController {
|
||||||
do {
|
do {
|
||||||
try persistentContainer.viewContext.save()
|
try persistentContainer.viewContext.save()
|
||||||
} catch {
|
} 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!)
|
_ = try await f(item.id!)
|
||||||
item.needsReadStateSync = false
|
item.needsReadStateSync = false
|
||||||
} catch {
|
} 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
|
item.needsReadStateSync = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ class FervorController {
|
||||||
do {
|
do {
|
||||||
try persistentContainer.viewContext.save()
|
try persistentContainer.viewContext.save()
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Failed to save view context: \(error.localizedDescription, privacy: .public)")
|
logger.error("Failed to save view context: \(String(describing: error), privacy: .public)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
do {
|
do {
|
||||||
try await fervorController.syncReadToServer()
|
try await fervorController.syncReadToServer()
|
||||||
} catch {
|
} 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 {
|
do {
|
||||||
try await self.fervorController.syncAll()
|
try await self.fervorController.syncAll()
|
||||||
} catch {
|
} 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)
|
ExcerptGenerator.generateAll(fervorController)
|
||||||
|
|
Loading…
Reference in New Issue