Skip to content

Commit

Permalink
add ability to configure catching exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Sep 26, 2017
1 parent bc84304 commit 4812e60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Symfony/Component/HttpKernel/CHANGELOG.md
Expand Up @@ -11,6 +11,7 @@ CHANGELOG
* added `AddCacheClearerPass`
* added `AddCacheWarmerPass`
* deprecated `EnvParametersResource`
* added `Symfony\Component\HttpKernel\Client::catchExceptions()`

3.3.0
-----
Expand Down
13 changes: 12 additions & 1 deletion src/Symfony/Component/HttpKernel/Client.php
Expand Up @@ -31,6 +31,7 @@
class Client extends BaseClient
{
protected $kernel;
private $catchExceptions = true;

/**
* Constructor.
Expand All @@ -49,6 +50,16 @@ public function __construct(HttpKernelInterface $kernel, array $server = array()
parent::__construct($server, $history, $cookieJar);
}

/**
* Sets whether to catch exceptions when the kernel is handling a request.
*
* @param bool $catchExceptions Whether to catch exceptions
*/
public function catchExceptions($catchExceptions)
{
$this->catchExceptions = $catchExceptions;
}

/**
* Makes a request.
*
Expand All @@ -58,7 +69,7 @@ public function __construct(HttpKernelInterface $kernel, array $server = array()
*/
protected function doRequest($request)
{
$response = $this->kernel->handle($request);
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions);

if ($this->kernel instanceof TerminableInterface) {
$this->kernel->terminate($request, $response);
Expand Down

0 comments on commit 4812e60

Please sign in to comment.