From 1c9cd2a7f03a66a1ae5132ff270e94a7fe6eb9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Gomez?= Date: Sat, 17 Oct 2015 17:45:51 +0200 Subject: Errors in the automatic tagging do not prevent the entry from being added --- src/Wallabag/CoreBundle/Helper/ContentProxy.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle/Helper') diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index dc6e1184..3d585e61 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -3,6 +3,7 @@ namespace Wallabag\CoreBundle\Helper; use Graby\Graby; +use Psr\Log\LoggerInterface as Logger; use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Tools\Utils; @@ -14,11 +15,13 @@ class ContentProxy { protected $graby; protected $tagger; + protected $logger; - public function __construct(Graby $graby, RuleBasedTagger $tagger) + public function __construct(Graby $graby, RuleBasedTagger $tagger, Logger $logger) { $this->graby = $graby; $this->tagger = $tagger; + $this->logger = $logger; } /** @@ -61,7 +64,14 @@ class ContentProxy $entry->setPreviewPicture($content['open_graph']['og_image']); } - $this->tagger->tag($entry); + try { + $this->tagger->tag($entry); + } catch (\Exception $e) { + $this->logger->error('Error while trying to automatically tag an entry.', array( + 'entry_url' => $url, + 'error_msg' => $e->getMessage(), + )); + } return $entry; } -- cgit v1.2.3