From cfef482366e296f2ab1526a97408114b4c1ef9a3 Mon Sep 17 00:00:00 2001 From: Korytov Pavel Date: Thu, 8 Feb 2024 17:36:03 +0300 Subject: [PATCH] [EconomistBridge] Handle 404s in feed gracefully (#3965) --- bridges/EconomistBridge.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bridges/EconomistBridge.php b/bridges/EconomistBridge.php index aad72275..70117cb0 100644 --- a/bridges/EconomistBridge.php +++ b/bridges/EconomistBridge.php @@ -99,7 +99,12 @@ class EconomistBridge extends FeedExpander protected function parseItem(array $item) { - $dom = getSimpleHTMLDOM($item['uri']); + try { + $dom = getSimpleHTMLDOM($item['uri']); + } catch (Exception $e) { + $item['content'] = $e->getMessage(); + return $item; + } $article = $dom->find('#new-article-template', 0); if ($article == null) {