Handle exceptions.
set_exception_handler
protected function exceptionHandler($exception) {
require_once DRUPAL_ROOT . '/core/includes/errors.inc';
$backtrace = $exception
->getTrace();
$verbose_backtrace = $backtrace;
// Push on top of the backtrace the call that generated the exception.
array_unshift($backtrace, array(
'line' => $exception
->getLine(),
'file' => $exception
->getFile(),
));
// The exception message is run through check_plain() by _drupal_decode_exception().
$message = format_string('%type: !message in %function (line %line of %file). <pre class="backtrace">!backtrace</pre>', _drupal_decode_exception($exception) + array(
'!backtrace' => format_backtrace($verbose_backtrace),
));
$this
->error($message, 'Uncaught exception', _drupal_get_last_caller($backtrace));
}