Fix article extractor error handling and recovery for when Mercury can't process a page
This commit is contained in:
parent
084749c233
commit
cf59733ca1
|
@ -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
|
||||
|
|
|
@ -963,6 +963,7 @@ extension SceneCoordinator: UINavigationControllerDelegate {
|
|||
extension SceneCoordinator: ArticleExtractorDelegate {
|
||||
|
||||
func articleExtractionDidFail(with: Error) {
|
||||
stopArticleExtractor()
|
||||
articleViewController?.articleExtractorButtonState = .error
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue