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 <[email protected]>
  • Loading branch information
Grotax committed Jun 23, 2024
1 parent 4d9fe9f commit b144030
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Service/FeedServiceV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use DateTime;
use FeedIo\Explorer;
use FeedIo\Reader\ReadErrorException;
use FeedIo\Reader\NoAccurateParserException;
use HTMLPurifier;

use OCA\News\Db\FeedMapperV2;
Expand Down Expand Up @@ -283,10 +284,17 @@ public function fetch(Entity $feed): Entity
$feed->getBasicAuthPassword(),
$feed->getHttpLastModified()
);
} catch (ReadErrorException $ex) {
} catch (ReadErrorException | NoAccurateParserException $ex) {
$feed->setUpdateErrorCount($feed->getUpdateErrorCount() + 1);
$feed->setLastUpdateError($ex->getMessage());

$this->logger->warning(
'Error while parsing feed: {url} {error}',
[
'url' => $location,
'error' => $ex
]
);
return $this->mapper->update($feed);
}

Expand Down

0 comments on commit b144030

Please sign in to comment.