add ability to configure catching exceptions
This commit is contained in:
parent
bc8430418b
commit
4812e6054c
@ -11,6 +11,7 @@ CHANGELOG
|
||||
* added `AddCacheClearerPass`
|
||||
* added `AddCacheWarmerPass`
|
||||
* deprecated `EnvParametersResource`
|
||||
* added `Symfony\Component\HttpKernel\Client::catchExceptions()`
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
@ -31,6 +31,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
class Client extends BaseClient
|
||||
{
|
||||
protected $kernel;
|
||||
private $catchExceptions = true;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -49,6 +50,16 @@ class Client extends BaseClient
|
||||
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.
|
||||
*
|
||||
@ -58,7 +69,7 @@ class Client extends BaseClient
|
||||
*/
|
||||
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);
|
||||
|
Reference in New Issue
Block a user