From fb69a2bc54fc65c1ba171ea8363cc6d67c6094da Mon Sep 17 00:00:00 2001 From: Kiel Gillard Date: Tue, 21 Jan 2020 18:31:35 +1100 Subject: [PATCH] Fix the logging of Feedly errors. #1628. --- .../Feedly/Operations/FeedlyDownloadArticlesOperation.swift | 6 ++++-- .../Account/Feedly/Operations/FeedlySyncAllOperation.swift | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Frameworks/Account/Feedly/Operations/FeedlyDownloadArticlesOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlyDownloadArticlesOperation.swift index 551b46cb7..f5131fab9 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlyDownloadArticlesOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlyDownloadArticlesOperation.swift @@ -88,8 +88,10 @@ extension FeedlyDownloadArticlesOperation: FeedlyOperationDelegate { func feedlyOperation(_ operation: FeedlyOperation, didFailWith error: Error) { assert(Thread.isMainThread) - // TODO: fix error for below line "Error is not convertible to NSError" - //os_log(.debug, log: log, "%{public}@ failed with error: %{public}@.", operation, error as NSError) + + // Having this log is useful for debugging missing required JSON keys in the response from Feedly, for example. + os_log(.debug, log: log, "%{public}@ failed with error: %{public}@.", String(describing: operation), error as NSError) + cancel() } } diff --git a/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift b/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift index 5aa2170dc..3aeae5fc5 100644 --- a/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift +++ b/Frameworks/Account/Feedly/Operations/FeedlySyncAllOperation.swift @@ -159,8 +159,9 @@ extension FeedlySyncAllOperation: FeedlyOperationDelegate { func feedlyOperation(_ operation: FeedlyOperation, didFailWith error: Error) { assert(Thread.isMainThread) - // TODO: fix error for below line "Error is not convertible to NSError" - //os_log(.debug, log: log, "%{public}@ failed with error: %{public}@.", operation, error as NSError) + + // Having this log is useful for debugging missing required JSON keys in the response from Feedly, for example. + os_log(.debug, log: log, "%{public}@ failed with error: %{public}@.", String(describing: operation), error as NSError) syncCompletionHandler?(.failure(error)) syncCompletionHandler = nil