1.2.0: report non-fatal errors to Crashlytics across key error paths

CrashlyticsService was wired only for the is_premium custom key. Route the
swallowed errors in the main catch blocks through CrashlyticsService.record
with a context tag, so non-fatals show up in Firebase (StoreKit load/purchase/
restore, calendar access/create/update/delete, reset-all-data, onboarding save).
Debug prints kept.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BkanrydYtrme8wipTzWssG
This commit is contained in:
alexandrev-tibco
2026-07-10 14:27:28 +02:00
parent 619d5f921d
commit 56abe28a82
4 changed files with 10 additions and 0 deletions
+4
View File
@@ -12,6 +12,7 @@ final class CalendarService {
do {
return try await eventStore.requestFullAccessToEvents()
} catch {
CrashlyticsService.record(error, context: "calendar_access")
print("Calendar access error: \(error)")
return false
}
@@ -55,6 +56,7 @@ final class CalendarService {
try eventStore.save(event, span: .thisEvent)
return event.eventIdentifier
} catch {
CrashlyticsService.record(error, context: "calendar_create")
print("Error saving event: \(error)")
return nil
}
@@ -99,6 +101,7 @@ final class CalendarService {
try eventStore.save(event, span: .thisEvent)
return event.eventIdentifier
} catch {
CrashlyticsService.record(error, context: "calendar_update")
print("Error updating event: \(error)")
return nil
}
@@ -109,6 +112,7 @@ final class CalendarService {
do {
try eventStore.remove(event, span: .thisEvent)
} catch {
CrashlyticsService.record(error, context: "calendar_delete")
print("Error deleting event: \(error)")
}
}
+3
View File
@@ -65,6 +65,7 @@ final class StoreManager: ObservableObject {
productLoadState = .timedOut
} else {
productLoadState = .failed
CrashlyticsService.record(error, context: "load_products")
}
print("Failed to load products: \(error)")
}
@@ -93,6 +94,7 @@ final class StoreManager: ObservableObject {
return .failed
}
} catch {
CrashlyticsService.record(error, context: "purchase")
print("Purchase failed: \(error)")
return .failed
}
@@ -110,6 +112,7 @@ final class StoreManager: ObservableObject {
AnalyticsService.logPremiumRestored()
}
} catch {
CrashlyticsService.record(error, context: "restore")
print("Restore failed: \(error)")
}
}
@@ -172,6 +172,7 @@ final class OnboardingViewModel: ObservableObject {
UserDefaults.standard.set(true, forKey: Self.pendingPremiumPromptKey)
return true
} catch {
CrashlyticsService.record(error, context: "onboarding_save")
print("Onboarding save failed: \(error)")
return false
}
@@ -97,12 +97,14 @@ final class SettingsViewModel: ObservableObject {
UserDefaults.standard.set(false, forKey: OnboardingViewModel.pendingPremiumPromptKey)
try context.save()
} catch {
CrashlyticsService.record(error, context: "reset_all_data")
#if DEBUG
print("Failed to complete reset all data: \(error)")
#endif
}
}
} catch {
CrashlyticsService.record(error, context: "reset_all_data_start")
#if DEBUG
print("Failed to start reset all data: \(error)")
#endif