mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Add error detail to activity.
This commit is contained in:
1 parent
7b6e5fcbd6
commit
dc37e5060d
1 file changed
+7
-4
@@ -211,15 +211,16 @@ import os
|
||||
let activityOwner = self.activityOwner
|
||||
let activityKind = ActivityKind.refreshFeedContent(feedURL: feed.url)
|
||||
|
||||
guard error == nil else {
|
||||
if let error {
|
||||
if let activityOwner {
|
||||
ActivityLog.shared.didComplete(activityOwner, kind: activityKind)
|
||||
ActivityLog.shared.didFail(activityOwner, kind: activityKind, error: error)
|
||||
}
|
||||
return
|
||||
}
|
||||
guard let httpResponse = response as? HTTPURLResponse else {
|
||||
if let activityOwner {
|
||||
ActivityLog.shared.didComplete(activityOwner, kind: activityKind)
|
||||
let error = NSError(domain: "LocalAccountRefresher", code: 0, userInfo: [NSLocalizedDescriptionKey: "Unexpected response (not HTTP)"])
|
||||
ActivityLog.shared.didFail(activityOwner, kind: activityKind, error: error)
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -228,7 +229,9 @@ import os
|
||||
let statusIsOKOrNotModified = statusIsOK || httpResponse.statusCode == HTTPResponseCode.notModified
|
||||
guard statusIsOKOrNotModified else {
|
||||
if let activityOwner {
|
||||
ActivityLog.shared.didComplete(activityOwner, kind: activityKind)
|
||||
let statusCode = httpResponse.statusCode
|
||||
let error = NSError(domain: "LocalAccountRefresher", code: statusCode, userInfo: [NSLocalizedDescriptionKey: "HTTP \(statusCode)"])
|
||||
ActivityLog.shared.didFail(activityOwner, kind: activityKind, error: error)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user