More tweaks to automatic error reporting
This commit is contained in:
parent
acd48a6db4
commit
a5fc35d0b1
|
@ -58,30 +58,27 @@ extension ToastConfiguration {
|
|||
// TODO: this is a bizarre place to do this, but code path covers basically all errors
|
||||
switch error.type {
|
||||
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_):
|
||||
SentrySDK.capture(error: error) { scope in
|
||||
scope.setFingerprint([String(describing: error)])
|
||||
let crumb = Breadcrumb(level: .error, category: "error")
|
||||
crumb.message = title
|
||||
crumb.data = [
|
||||
"request_method": error.requestMethod.name,
|
||||
"request_endpoint": error.requestEndpoint.description,
|
||||
]
|
||||
switch error.type {
|
||||
case .invalidRequest:
|
||||
crumb.data!["error_type"] = "invalid_request"
|
||||
case .invalidResponse:
|
||||
crumb.data!["error_type"] = "invalid_response"
|
||||
case .invalidModel(let error):
|
||||
crumb.data!["error_type"] = "invalid_model"
|
||||
crumb.data!["underlying_error"] = String(describing: error)
|
||||
case .mastodonError(let error):
|
||||
crumb.data!["error_type"] = "mastodon_error"
|
||||
crumb.data!["underlying_error"] = error
|
||||
default:
|
||||
break
|
||||
}
|
||||
scope.add(crumb)
|
||||
let event = Event(error: error)
|
||||
event.message = SentryMessage(formatted: "\(title): \(error)")
|
||||
event.tags = [
|
||||
"request_method": error.requestMethod.name,
|
||||
"request_endpoint": error.requestEndpoint.description,
|
||||
]
|
||||
switch error.type {
|
||||
case .invalidRequest:
|
||||
event.tags!["error_type"] = "invalid_request"
|
||||
case .invalidResponse:
|
||||
event.tags!["error_type"] = "invalid_response"
|
||||
case .invalidModel(let error):
|
||||
event.tags!["error_type"] = "invalid_model"
|
||||
event.tags!["underlying_error"] = String(describing: error)
|
||||
case .mastodonError(let error):
|
||||
event.tags!["error_type"] = "mastodon_error"
|
||||
event.tags!["underlying_error"] = error
|
||||
default:
|
||||
break
|
||||
}
|
||||
SentrySDK.capture(event: event)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue