On this page
function _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 559
- 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);
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!bootstrap.inc/function/_drupal_exception_handler/8.1.x