Skip to content

Commit

Permalink
log warning if feed cannot be parsed
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
  • Loading branch information
Grotax committed Jun 22, 2024
1 parent 4d9fe9f commit 6957c6b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use FeedIo\FeedInterface;
use FeedIo\FeedIo;
use FeedIo\Reader\ReadErrorException;
use FeedIo\Reader\NoAccurateParserException;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ConnectException;
Expand Down Expand Up @@ -135,7 +136,19 @@ public function fetch(
$lastModified = null;
}
$url = $url2->getNormalizedURL();
$resource = $this->reader->read($url, null, $lastModified);

try {
$resource = $this->reader->read($url, null, $lastModified);
} catch (NoAccurateParserException) {
$this->logger->warning(
'Feed {url} cannot be be parsed',
[
'url' => $url,
]
);
throw new ReadErrorException("Feed cannot be parsed.");
}


$location = $resource->getUrl();
$parsedFeed = $resource->getFeed();
Expand Down

0 comments on commit 6957c6b

Please sign in to comment.