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: The exception object that was thrown.
File
- includes/bootstrap.inc, line 2589
- Functions that need to be loaded on every Drupal request.
Code
function _drupal_exception_handler($exception) { require_once DRUPAL_ROOT . '/includes/errors.inc'; try { // Log the message to the watchdog and return an error page to the user. _drupal_log_error(_drupal_decode_exception($exception), TRUE); } catch (Exception $exception2) { // Another uncaught exception was thrown while handling the first one. // If we are displaying errors, then do so with no possibility of a further uncaught exception being thrown. if (error_displayable()) { print '<h1>Additional uncaught exception thrown while handling exception.</h1>'; print '<h2>Original</h2><p>' . _drupal_render_exception_safe($exception) . '</p>'; print '<h2>Additional</h2><p>' . _drupal_render_exception_safe($exception2) . '</p><hr />'; } } }
© 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/includes!bootstrap.inc/function/_drupal_exception_handler/7.x