From 4857b507b1bd8a7163edbe05509eb835ea17cfc9 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 31 Oct 2022 12:26:09 -0400 Subject: [PATCH] Send CoreData saving errors to Sentry --- Tusker/CoreData/MastodonCachePersistentStore.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tusker/CoreData/MastodonCachePersistentStore.swift b/Tusker/CoreData/MastodonCachePersistentStore.swift index b54281c5..346f0e36 100644 --- a/Tusker/CoreData/MastodonCachePersistentStore.swift +++ b/Tusker/CoreData/MastodonCachePersistentStore.swift @@ -11,6 +11,7 @@ import CoreData import Pachyderm import Combine import OSLog +import Sentry fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PersistentStore") @@ -73,6 +74,9 @@ class MastodonCachePersistentStore: NSPersistentContainer { try context.save() } catch { 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") } }