function _drupal_exception_handler

Same name and namespace in other branches
  1. 7.x includes/bootstrap.inc \_drupal_exception_handler()
  2. 9 core/includes/bootstrap.inc \_drupal_exception_handler()
  3. 8.9.x core/includes/bootstrap.inc \_drupal_exception_handler()
  4. 10 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 121

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.