protected function TestBase::exceptionHandler in Drupal 8
Handle exceptions.
See also
set_exception_handler
1 call to TestBase::exceptionHandler()
- TestBase::run in core/
modules/ simpletest/ src/ TestBase.php - Run all tests in this class.
File
- core/
modules/ simpletest/ src/ TestBase.php, line 1337
Class
- TestBase
- Base class for Drupal tests.
Namespace
Drupal\simpletestCode
protected function exceptionHandler($exception) {
$backtrace = $exception
->getTrace();
$verbose_backtrace = $backtrace;
// Push on top of the backtrace the call that generated the exception.
array_unshift($backtrace, [
'line' => $exception
->getLine(),
'file' => $exception
->getFile(),
]);
$decoded_exception = Error::decodeException($exception);
unset($decoded_exception['backtrace']);
$message = new FormattableMarkup('%type: @message in %function (line %line of %file). <pre class="backtrace">@backtrace</pre>', $decoded_exception + [
'@backtrace' => Error::formatBacktrace($verbose_backtrace),
]);
$this
->error($message, 'Uncaught exception', Error::getLastCaller($backtrace));
}