You are here

function _drupal_exception_handler in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/bootstrap.inc \_drupal_exception_handler()

Provides custom PHP exception handling.

Uncaught exceptions are those not enclosed in a try/catch block. They are always fatal: the execution of the script will stop as soon as the exception handler exits.

Parameters

\Exception|\Throwable $exception: The exception object that was thrown.

3 string references to '_drupal_exception_handler'
DrupalKernel::bootEnvironment in core/lib/Drupal/Core/DrupalKernel.php
Setup a consistent PHP environment.
drupal_rebuild in core/includes/utility.inc
Rebuilds all caches even when Drupal itself does not work.
ErrorTest::providerTestGetLastCaller in core/tests/Drupal/Tests/Core/Utility/ErrorTest.php
Data provider for testGetLastCaller.

File

core/includes/bootstrap.inc, line 555
Functions that need to be loaded on every Drupal request.

Code

function _drupal_exception_handler($exception) {
  require_once __DIR__ . '/errors.inc';
  try {

    // Log the message to the watchdog and return an error page to the user.
    _drupal_log_error(Error::decodeException($exception), TRUE);
  } catch (\Throwable $error) {
    _drupal_exception_handler_additional($exception, $error);
  } catch (\Exception $exception2) {
    _drupal_exception_handler_additional($exception, $exception2);
  }
}