Log errors that result in showing a toast to the user
This commit is contained in:
parent
ab8ccbb408
commit
8b7c78e3b1
|
@ -9,6 +9,7 @@
|
|||
import UIKit
|
||||
import Pachyderm
|
||||
import Sentry
|
||||
import OSLog
|
||||
|
||||
struct ToastConfiguration {
|
||||
var systemImageName: String?
|
||||
|
@ -89,6 +90,8 @@ fileprivate extension Pachyderm.Client.Error {
|
|||
}
|
||||
}
|
||||
|
||||
private let toastErrorLogger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "ToastError")
|
||||
|
||||
private func captureError(_ error: Client.Error, title: String) {
|
||||
let event = Event(error: error)
|
||||
event.message = SentryMessage(formatted: "\(title): \(error)")
|
||||
|
@ -123,4 +126,6 @@ private func captureError(_ error: Client.Error, title: String) {
|
|||
return
|
||||
}
|
||||
SentrySDK.capture(event: event)
|
||||
|
||||
toastErrorLogger.error("\(title, privacy: .public): \(error), \(event.tags!.debugDescription, privacy: .public)")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue