Skip to content

Commit

Permalink
πŸ•΅οΈβ€β™‚οΈ Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen Melbourne committed Feb 9, 2021
1 parent c844ee4 commit 4c9d97d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/Crawler/CrawlObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Psr\Http\Message\UriInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Exception\RequestException;
use App\Notifications\BrowserMessageDetected;
use Spatie\Crawler\CrawlObserver as SpatieCrawlObserver;

class CrawlObserver extends SpatieCrawlObserver
Expand Down Expand Up @@ -91,13 +92,15 @@ public function crawlFailed(UriInterface $url, RequestException $requestExceptio
$page->response = null;
$page->exception = $requestException->getCode() . ' - ' . $requestException->getMessage();

BrowserConsoleCheck::dispatch($this->website, $page);
$this->notify($page);

return $page->save();
}

private function notify(CrawledPage $page)
{
// dump($page->exception);
$page->website->user->notify(
new BrowserMessageDetected($page->website, $page)
);
}
}
2 changes: 1 addition & 1 deletion resources/views/mail/browser-message.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Please see the output below:

<div style="padding: 20px; background: #f1f2fb;">
<pre style="margin:0;padding:0;"><code style="margin:0;padding:0;">{{ $page->messages }}</code></pre>
<pre style="margin:0;padding:0;"><code style="margin:0;padding:0;">{{ $page->messages ?? $page->exception ?? $page->response }}</code></pre>
</div>

@component('mail::button', ['url' => $website->show_link])
Expand Down

0 comments on commit 4c9d97d

Please sign in to comment.