You are here

protected function LinkCheckerService::exceptionHandling in Link checker 8

Exception handling.

Parameters

\GuzzleHttp\Exception\RequestException $e: An object containing the Exception.

\Drupal\linkchecker\LinkCheckerLinkInterface $link: The link.

1 call to LinkCheckerService::exceptionHandling()
LinkCheckerService::check in src/LinkCheckerService.php
Check the link.

File

src/LinkCheckerService.php, line 339

Class

LinkCheckerService
Class LinkCheckerService.

Namespace

Drupal\linkchecker

Code

protected function exceptionHandling(RequestException $e, LinkCheckerLinkInterface $link) {
  $link
    ->setStatusCode('502');
  $link
    ->setErrorMessage($e
    ->getMessage());
  $link
    ->setFailCount($link
    ->getFailCount() + 1);
  $link
    ->setLastCheckTime($this->time
    ->getCurrentTime());
  $link
    ->save();
  linkchecker_watchdog_log('linkchecker', 'Unhandled link error %link has been found: : %message.', [
    '%link' => $link
      ->getUrl(),
    '%message' => $e
      ->getMessage(),
  ], RfcLogLevel::ERROR, $this
    ->getReportLink());
  $this
    ->updateSameLinks($link);
}