Skip to content

Commit 3169ed5

Browse files
Jonathanm10barryvdh
authored andcommitted
Add stack trace to exceptions (php-debugbar#397)
1 parent b49e46a commit 3169ed5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/DebugBar/DataCollector/ExceptionsCollector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public function formatThrowableData($e)
108108
'code' => $e->getCode(),
109109
'file' => $filePath,
110110
'line' => $e->getLine(),
111+
'stack_trace' => $e->getTraceAsString(),
111112
'surrounding_lines' => $lines,
112113
'xdebug_link' => $this->getXdebugLink($filePath, $e->getLine())
113114
);

src/DebugBar/Resources/widgets.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,13 @@ if (typeof(PhpDebugBar) == 'undefined') {
558558
}
559559
});
560560
}
561+
if (e.stack_trace) {
562+
e.stack_trace.split("\n").forEach(function(trace) {
563+
var $traceLine = $('<div />');
564+
$('<span />').addClass(csscls('filename')).text(trace).appendTo($traceLine);
565+
$traceLine.appendTo(li);
566+
});
567+
}
561568
}});
562569
this.$list.$el.appendTo(this.$el);
563570

0 commit comments

Comments
 (0)