protected function TestBase::exceptionHandler

Handle exceptions.

See also

set_exception_handler

1 call to TestBase::exceptionHandler()
TestBase::run in drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php
Run all tests in this class.

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php, line 1071
Definition of Drupal\simpletest\TestBase.

Class

TestBase
Base class for Drupal tests.

Namespace

Drupal\simpletest

Code

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));
}