forked from shadowfacts/Tusker
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
|
// TODO: this is a bizarre place to do this, but code path covers basically all errors
|
||||||
switch error.type {
|
switch error.type {
|
||||||
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_):
|
case .invalidRequest, .invalidResponse, .invalidModel(_), .mastodonError(_):
|
||||||
SentrySDK.capture(error: error) { scope in
|
let event = Event(error: error)
|
||||||
scope.setFingerprint([String(describing: error)])
|
event.message = SentryMessage(formatted: "\(title): \(error)")
|
||||||
let crumb = Breadcrumb(level: .error, category: "error")
|
event.tags = [
|
||||||
crumb.message = title
|
"request_method": error.requestMethod.name,
|
||||||
crumb.data = [
|
"request_endpoint": error.requestEndpoint.description,
|
||||||
"request_method": error.requestMethod.name,
|
]
|
||||||
"request_endpoint": error.requestEndpoint.description,
|
switch error.type {
|
||||||
]
|
case .invalidRequest:
|
||||||
switch error.type {
|
event.tags!["error_type"] = "invalid_request"
|
||||||
case .invalidRequest:
|
case .invalidResponse:
|
||||||
crumb.data!["error_type"] = "invalid_request"
|
event.tags!["error_type"] = "invalid_response"
|
||||||
case .invalidResponse:
|
case .invalidModel(let error):
|
||||||
crumb.data!["error_type"] = "invalid_response"
|
event.tags!["error_type"] = "invalid_model"
|
||||||
case .invalidModel(let error):
|
event.tags!["underlying_error"] = String(describing: error)
|
||||||
crumb.data!["error_type"] = "invalid_model"
|
case .mastodonError(let error):
|
||||||
crumb.data!["underlying_error"] = String(describing: error)
|
event.tags!["error_type"] = "mastodon_error"
|
||||||
case .mastodonError(let error):
|
event.tags!["underlying_error"] = error
|
||||||
crumb.data!["error_type"] = "mastodon_error"
|
default:
|
||||||
crumb.data!["underlying_error"] = error
|
break
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
scope.add(crumb)
|
|
||||||
}
|
}
|
||||||
|
SentrySDK.capture(event: event)
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue