Skip to content
Discussion options

You must be logged in to vote

Hey

The problem is that there is no dedicated TimeoutException in Browsershot. What you could do is this:

use Hammerstone\Sidecar\Exceptions\LambdaExecutionException;
use Illuminate\Support\Str;
use Spatie\Browsershot\Browsershot;
use Wnx\SidecarBrowsershot\BrowsershotLambda;

try {
    $screenshot = BrowsershotLambda::url('https://github.com')
        ->base64Screenshot();
} catch (LambdaExecutionException $exception) {

    // Check if the Exception Message contains "TimeoutError".
    // If so, fallback to the local Browsershot instance.
    // Or you can do something else.
    if (Str::contains($exception->getMessage(), 'TimeoutError: Navigation timeout of')) {
        $screenshot = B…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phuclh
Comment options

Answer selected by phuclh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants