Make article extractor report correct state on failed Mercury parses

This commit is contained in:
Maurice Parker 2019-10-04 07:39:49 -05:00
parent 269b9315b2
commit f7fd003f3c
1 changed files with 2 additions and 1 deletions

View File

@ -79,11 +79,12 @@ class ArticleExtractor {
decoder.dateDecodingStrategy = .iso8601
self.article = try decoder.decode(ExtractedArticle.self, from: data)
self.state = .complete
DispatchQueue.main.async {
if self.article?.content == nil {
self.state = .failedToParse
self.delegate?.articleExtractionDidFail(with: URLError(.cannotDecodeContentData))
} else {
self.state = .complete
self.delegate?.articleExtractionDidComplete(extractedArticle: self.article!)
}
}