Send CoreData saving errors to Sentry
This commit is contained in:
parent
bca7bd3586
commit
4857b507b1
|
@ -11,6 +11,7 @@ import CoreData
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Combine
|
import Combine
|
||||||
import OSLog
|
import OSLog
|
||||||
|
import Sentry
|
||||||
|
|
||||||
fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PersistentStore")
|
fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PersistentStore")
|
||||||
|
|
||||||
|
@ -73,6 +74,9 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
||||||
try context.save()
|
try context.save()
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Unable to save managed object context: \(String(describing: error), privacy: .public)")
|
logger.error("Unable to save managed object context: \(String(describing: error), privacy: .public)")
|
||||||
|
let crumb = Breadcrumb(level: .fatal, category: "PersistentStore")
|
||||||
|
crumb.message = String(describing: error)
|
||||||
|
SentrySDK.addBreadcrumb(crumb: crumb)
|
||||||
fatalError("Unable to save managed object context")
|
fatalError("Unable to save managed object context")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue