Skip to content

Commit 595f4e5

Browse files
authored
fix getProfile fail logic (#36)
1 parent 4cdf870 commit 595f4e5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Codeception/Module/Symfony.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ public function runSymfonyConsoleCommand($command, $parameters = [], $consoleInp
599599

600600
return $output;
601601
}
602+
602603
/**
603604
* @return \Symfony\Component\HttpKernel\Profiler\Profile
604605
*/
@@ -610,11 +611,15 @@ protected function getProfile()
610611
}
611612

612613
$profiler = $this->grabService('profiler');
613-
$response = $this->client->getResponse();
614-
if (null === $response) {
615-
$this->fail("You must perform a request before using this method.");
614+
try {
615+
$response = $this->client->getResponse();
616+
return $profiler->loadProfileFromResponse($response);
617+
} catch (\BadMethodCallException $e) {
618+
$this->fail('You must perform a request before using this method.');
619+
} catch (\Exception $e) {
620+
$this->fail($e->getMessage());
616621
}
617-
return $profiler->loadProfileFromResponse($response);
622+
return null;
618623
}
619624

620625
/**

0 commit comments

Comments
 (0)