TF-4269 Apply PR review: breadcrumbs, log error details, and code cleanup for NSE Sentry integration
- Replace capture(message:) with addBreadcrumb(level: .warning) in NotificationService for non-error diagnostic checkpoints - Add addBreadcrumb method to SentryManager with category/level support - Include error details in KeychainController SentryConfig decode failure log - Split combined guard into two separate guards to distinguish nil state vs unchanged state - Remove dead do-catch block in onComplete closure; use errors.forEach to capture real errors - Translate Vietnamese doc comment to English in SentryManager
This commit is contained in:
@@ -75,7 +75,20 @@ class SentryManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// Set user context cho Sentry
|
||||
/// Adds a breadcrumb to the current Sentry scope.
|
||||
/// Breadcrumbs are accumulated in-memory and automatically attached to the next
|
||||
/// captured error event. Use this for diagnostic checkpoints that provide context
|
||||
/// for real errors — they are NOT sent as standalone events.
|
||||
func addBreadcrumb(message: String, category: String = "nse", level: SentryLevel = .info) {
|
||||
guard isInitialized else { return }
|
||||
let crumb = Breadcrumb()
|
||||
crumb.message = message
|
||||
crumb.category = category
|
||||
crumb.level = level
|
||||
SentrySDK.addBreadcrumb(crumb)
|
||||
}
|
||||
|
||||
/// Set user context for Sentry
|
||||
func setSentryUser(_ user: User) {
|
||||
guard isInitialized else { return }
|
||||
SentrySDK.setUser(user)
|
||||
|
||||
Reference in New Issue
Block a user