mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
Errors in the automatic tagging do not prevent the entry from being added
This commit is contained in:
parent
1dc4e5da2e
commit
1c9cd2a7f0
3 changed files with 21 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue