Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Sep 13, 2020
1 parent 34fde07 commit 1f954a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `spatie/crawler` will be documented in this file.

## 4.7.5 - 2020-09-12

- treat connection exceptions as request exceptions

## 4.7.4 - 2020-07-15

- fix: method and property name error (#311)
Expand Down
5 changes: 5 additions & 0 deletions src/Handlers/CrawlRequestFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Spatie\Crawler\Handlers;

use Exception;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use Spatie\Crawler\Crawler;

Expand All @@ -18,6 +19,10 @@ public function __construct(Crawler $crawler)

public function __invoke(Exception $exception, $index)
{
if ($exception instanceof ConnectException) {
$exception = new RequestException('', $exception->getRequest());
}

if ($exception instanceof RequestException) {
$crawlUrl = $this->crawler->getCrawlQueue()->getUrlById($index);

Expand Down

0 comments on commit 1f954a5

Please sign in to comment.