_drupal_exception_handler

_drupal_exception_handler($exception)

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.

File

core/includes/bootstrap.inc, line 561
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);
  }
  // PHP 7 introduces Throwable, which covers both Error and
  // Exception throwables.
  catch (\Throwable $error) {
    _drupal_exception_handler_additional($exception, $error);
  }
  // In order to be compatible with PHP 5 we also catch regular Exceptions.
  catch (\Exception $exception2) {
    _drupal_exception_handler_additional($exception, $exception2);
  }
}
doc_Drupal
2016-10-29 09:57:09
Comments
Leave a Comment

Please login to continue.