forked from shadowfacts/Tusker
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 UIKit
|
||||||
import Pachyderm
|
import Pachyderm
|
||||||
import Sentry
|
import Sentry
|
||||||
|
import OSLog
|
||||||
|
|
||||||
struct ToastConfiguration {
|
struct ToastConfiguration {
|
||||||
var systemImageName: String?
|
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) {
|
private func captureError(_ error: Client.Error, title: String) {
|
||||||
let event = Event(error: error)
|
let event = Event(error: error)
|
||||||
event.message = SentryMessage(formatted: "\(title): \(error)")
|
event.message = SentryMessage(formatted: "\(title): \(error)")
|
||||||
|
@ -123,4 +126,6 @@ private func captureError(_ error: Client.Error, title: String) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
SentrySDK.capture(event: event)
|
SentrySDK.capture(event: event)
|
||||||
|
|
||||||
|
toastErrorLogger.error("\(title, privacy: .public): \(error), \(event.tags!.debugDescription, privacy: .public)")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue