Skip to content

Commit

Permalink
fix headless browser bugs: catch headless lib's exception properly
Browse files Browse the repository at this point in the history
  • Loading branch information
blogdaren committed Oct 29, 2024
1 parent 7d0b889 commit 0bd2a22
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.js linguist-language=PHP
*.css linguist-language=PHP
*.html linguist-language=PHP
*.c linguist-language=C
4 changes: 1 addition & 3 deletions src/Kernel/Middleware/HeadlessBrowser/Chrome.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,12 @@ public function request($method, $url, $args = [])
]));
}

$page = self::getPage();

try{
$page = self::getPage();
$page->navigate($url)->waitForNavigation($page_event, $navigate_timeout);
$html = $page->getHtml();
$page->close();
}catch(\Throwable $e){
$page->close();
//since the headless lib don't define an exception code,
//so we have to define a uniform exception code here....
throw new \Exception($e->getMessage(), -400);
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/PHPCreeper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PHPCreeper extends Worker
*
* @var string
*/
public const CURRENT_VERSION = '1.9.8';
public const CURRENT_VERSION = '1.9.9';

/**
* engine name
Expand Down

0 comments on commit 0bd2a22

Please sign in to comment.