namespace Wallabag\CoreBundle\Helper;
use Graby\Graby;
+use Psr\Log\LoggerInterface as Logger;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Tools\Utils;
{
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->graby = $graby;
$this->tagger = $tagger;
+ $this->logger = $logger;
}
/**
$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;
}