>On 8/15/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote: > > > $response->isException() indicates an exception exists. You can then > fetch the exception stack (response object puts all exceptions trapped > into an internal array) by using: > > $exceptions = $response->getException(); > > You can then loop over each exception in that list to get stack traces. >
Hi Matthew, Thanks for the answer but after more tinkering I think I should process the stack trace output of native "getTraceAsString" from the exception class instead. Since "ne" is a non existent action in http://sitename.com/dummy/ne, after evaluating this line: $response = $controller->dispatch(); A fatal error will be sent to the browser because exception thrown from $controller->dispatch() is not caught. Stack traces are properly outputted to the screen. Now a try-catch block is added and $response is now within a try block: try { $response = $controller->dispatch(); ..remaining code } catch (Exception $e) { $traces = $e->getTraceAsString(); $message = $e->getMessage(); ...beautify the stack traces along with error message } The "remaining code" part won't be evaluated because exception has been thrown and caught. Because $response is still unset, "getException" method can not be used, hence I should fall back to the basic exception handler. Not a pretty neat solution, I'll be happy to see other approaches to error trapping and handling. Regards, Mike
