Allow for error on query when looking for existing starred records.

This commit is contained in:
Maurice Parker 2020-04-07 19:02:25 -05:00
parent 6a9620e4de
commit ae091afb18
1 changed files with 3 additions and 9 deletions

View File

@ -147,7 +147,6 @@ private extension CloudKitArticlesZone {
func makeArticleRecordsIfNecessary(_ articles: Set<Article>, completion: @escaping ((Result<[CKRecord], Error>) -> Void)) {
let group = DispatchGroup()
var errorOccurred = false
var records = [CKRecord]()
for article in articles {
@ -164,9 +163,8 @@ private extension CloudKitArticlesZone {
if !recordFound {
records.append(contentsOf: self.makeArticleRecords(article))
}
case .failure(let error):
errorOccurred = true
os_log(.error, log: self.log, "Error occurred while checking for existing articles: %@", error.localizedDescription)
case .failure:
records.append(contentsOf: self.makeArticleRecords(article))
}
group.leave()
}
@ -174,11 +172,7 @@ private extension CloudKitArticlesZone {
}
group.notify(queue: DispatchQueue.main) {
if errorOccurred {
completion(.failure(CloudKitZoneError.unknown))
} else {
completion(.success(records))
}
completion(.success(records))
}
}