Fix article extractor error handling and recovery for when Mercury can't process a page

This commit is contained in:
Maurice Parker 2019-10-03 21:06:47 -05:00
parent 084749c233
commit cf59733ca1
2 changed files with 6 additions and 1 deletions

View File

@ -81,7 +81,11 @@ class ArticleExtractor {
self.state = .complete
DispatchQueue.main.async {
self.delegate?.articleExtractionDidComplete(extractedArticle: self.article!)
if self.article?.content == nil {
self.delegate?.articleExtractionDidFail(with: URLError(.cannotDecodeContentData))
} else {
self.delegate?.articleExtractionDidComplete(extractedArticle: self.article!)
}
}
} catch {
self.state = .failedToParse

View File

@ -963,6 +963,7 @@ extension SceneCoordinator: UINavigationControllerDelegate {
extension SceneCoordinator: ArticleExtractorDelegate {
func articleExtractionDidFail(with: Error) {
stopArticleExtractor()
articleViewController?.articleExtractorButtonState = .error
}