From 8398de88c95a421cb7d98d0fafce39e49f5161a9 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Sun, 9 Mar 2014 11:37:50 +0100 Subject: [PATCH] Make chaining configurable --- src/DebugBar/DataCollector/ExceptionsCollector.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/DebugBar/DataCollector/ExceptionsCollector.php b/src/DebugBar/DataCollector/ExceptionsCollector.php index d3ad738..969af64 100644 --- a/src/DebugBar/DataCollector/ExceptionsCollector.php +++ b/src/DebugBar/DataCollector/ExceptionsCollector.php @@ -18,6 +18,7 @@ use Exception; class ExceptionsCollector extends DataCollector implements Renderable { protected $exceptions = array(); + protected $chainExceptions = false; /** * 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) { $this->exceptions[] = $e; - if($previous = $e->getPrevious()){ + if($this->chainExceptions && $previous = $e->getPrevious()){ $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 *