protected function DrupalTestCase::exceptionHandler

7.x drupal_web_test_case.php protected DrupalTestCase::exceptionHandler($exception)

Handle exceptions.

See also

set_exception_handler

1 call to DrupalTestCase::exceptionHandler()
DrupalTestCase::run in drupal-7.x/modules/simpletest/drupal_web_test_case.php
Run all tests in this class.

File

drupal-7.x/modules/simpletest/drupal_web_test_case.php, line 564

Class

DrupalTestCase
Base class for Drupal tests.

Code

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