@@ -25,15 +25,23 @@ class ExceptionsCollector extends DataCollector implements Renderable
25
25
* Adds an exception to be profiled in the debug bar
26
26
*
27
27
* @param Exception $e
28
+ * @deprecated in favor on addThrowable
28
29
*/
29
30
public function addException (Exception $ e )
31
+ {
32
+ $ this ->addThrowable ($ e );
33
+ }
34
+
35
+ /**
36
+ * Adds a Throwable to be profiled in the debug bar
37
+ *
38
+ * @param \Throwable $e
39
+ */
40
+ public function addThrowable ($ e )
30
41
{
31
42
$ this ->exceptions [] = $ e ;
32
43
if ($ this ->chainExceptions && $ previous = $ e ->getPrevious ()) {
33
- if (!$ previous instanceof Exception) {
34
- $ previous = new FatalThrowableError ($ previous );
35
- }
36
- $ this ->addException ($ previous );
44
+ $ this ->addThrowable ($ previous );
37
45
}
38
46
}
39
47
@@ -50,7 +58,7 @@ public function setChainExceptions($chainExceptions = true)
50
58
/**
51
59
* Returns the list of exceptions being profiled
52
60
*
53
- * @return array[Exception ]
61
+ * @return array[\Throwable ]
54
62
*/
55
63
public function getExceptions ()
56
64
{
@@ -61,7 +69,7 @@ public function collect()
61
69
{
62
70
return array (
63
71
'count ' => count ($ this ->exceptions ),
64
- 'exceptions ' => array_map (array ($ this , 'formatExceptionData ' ), $ this ->exceptions )
72
+ 'exceptions ' => array_map (array ($ this , 'formatThrowableData ' ), $ this ->exceptions )
65
73
);
66
74
}
67
75
@@ -70,8 +78,20 @@ public function collect()
70
78
*
71
79
* @param Exception $e
72
80
* @return array
81
+ * @deprecated in favor on formatThrowableData
73
82
*/
74
83
public function formatExceptionData (Exception $ e )
84
+ {
85
+ return $ this ->formatThrowableData ($ e );
86
+ }
87
+
88
+ /**
89
+ * Returns Throwable data as an array
90
+ *
91
+ * @param \Throwable $e
92
+ * @return array
93
+ */
94
+ public function formatThrowableData ($ e )
75
95
{
76
96
$ filePath = $ e ->getFile ();
77
97
if ($ filePath && file_exists ($ filePath )) {
0 commit comments