Skip to content

Commit 289028f

Browse files
committed
Symfony 5: Catch another exception
1 parent af5ef76 commit 289028f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,15 @@ private function getCrawler()
296296

297297
private function getRunningClient()
298298
{
299-
if ($this->client->getInternalRequest() === null) {
299+
try {
300+
if ($this->client->getInternalRequest() === null) {
301+
throw new ModuleException(
302+
$this,
303+
"Page not loaded. Use `\$I->amOnPage` (or hidden API methods `_request` and `_loadPage`) to open it"
304+
);
305+
}
306+
} catch (BadMethodCallException $e) {
307+
//Symfony 5
300308
throw new ModuleException(
301309
$this,
302310
"Page not loaded. Use `\$I->amOnPage` (or hidden API methods `_request` and `_loadPage`) to open it"

0 commit comments

Comments
 (0)