Skip to content

Commit

Permalink
Update Readability.php to include FFReadability class and error handl…
Browse files Browse the repository at this point in the history
…ing for parse method.
  • Loading branch information
murdercode committed Mar 2, 2024
1 parent 9e06390 commit c2b1648
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Readability.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@

class Readability
{
private $content;
private ?FFReadability $content;

/**
* Parse the content
*
* @throws Exception
*/
public function parse(string $content): self
{
$this->content = new FFReadability(new Configuration());
try {
$this->content->parse($content);
} catch (ParseException $e) {
$this->content = null;
error_log('Cannot parse: '.$e->getMessage());
throw new Exception('Cannot parse: '.$e->getMessage());
error_log('Cannot parse: ' . $e->getMessage());
throw new Exception('Cannot parse: ' . $e->getMessage());
}

return $this;
Expand Down

0 comments on commit c2b1648

Please sign in to comment.