08-19-2008, 12:22 AM
|
#9 (permalink)
|
|
The Frequenter
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
|
Quote:
Originally Posted by Kalle
Reflection does not provide the information he want in this case because it does not provide a stack trace like debug_backtrace().
|
Oh yes, it does. You just don't know about it :P
Try the getTrace method for an array containg all the trace info you need, and format it as you need, or, use the built-in getTraceAsString method, to get a default trace format. You can, of course, use something like this on the output:
PHP Code:
try { // ... } catch(Exception $e) { echo str_replace("\n", '<br />', $e->getTraceAsString()); }
to get a perfectly readable and displayable HTML form of the stack trace. Awesome, right? :D
The advantage of the exceptions is that you don't need to log the line on which an exception occured, nor the file in which the source code of the function/method was located. The exceptional engine keeps in mind all that stuff (and this is just the beginning of it) :) All you need to do is nicely ask for it.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
|
|
|
|