Make article extractor report correct state on failed Mercury parses
This commit is contained in:
parent
269b9315b2
commit
f7fd003f3c
|
@ -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!)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue