mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-17 13:28:35 +01:00
Make chaining configurable
This commit is contained in:
parent
dc21739880
commit
8398de88c9
@ -18,6 +18,7 @@ use Exception;
|
|||||||
class ExceptionsCollector extends DataCollector implements Renderable
|
class ExceptionsCollector extends DataCollector implements Renderable
|
||||||
{
|
{
|
||||||
protected $exceptions = array();
|
protected $exceptions = array();
|
||||||
|
protected $chainExceptions = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an exception to be profiled in the debug bar
|
* Adds an exception to be profiled in the debug bar
|
||||||
@ -27,11 +28,21 @@ class ExceptionsCollector extends DataCollector implements Renderable
|
|||||||
public function addException(Exception $e)
|
public function addException(Exception $e)
|
||||||
{
|
{
|
||||||
$this->exceptions[] = $e;
|
$this->exceptions[] = $e;
|
||||||
if($previous = $e->getPrevious()){
|
if($this->chainExceptions && $previous = $e->getPrevious()){
|
||||||
$this->addException($previous);
|
$this->addException($previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure whether or not all chained exceptions should be shown.
|
||||||
|
*
|
||||||
|
* @param bool $chainExceptions
|
||||||
|
*/
|
||||||
|
public function setChainExceptions($chainExceptions = true)
|
||||||
|
{
|
||||||
|
$this->chainExceptions = $chainExceptions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of exceptions being profiled
|
* Returns the list of exceptions being profiled
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user