W3cubDocs

/Drupal 8

function _drupal_shutdown_function_handle_exception

_drupal_shutdown_function_handle_exception($exception)

Displays and logs any errors that may happen during shutdown.

Parameters

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

See also

_drupal_shutdown_function()

File

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

Code

function _drupal_shutdown_function_handle_exception($exception) {
  // If using PHP-FPM then fastcgi_finish_request() will have been fired
  // preventing further output to the browser.
  if (!function_exists('fastcgi_finish_request')) {
    // If we are displaying errors, then do so with no possibility of a
    // further uncaught exception being thrown.
    require_once __DIR__ . '/errors.inc';
    if (error_displayable()) {
      print '<h1>Uncaught exception thrown in shutdown function.</h1>';
      print '<p>' . Error::renderExceptionSafe($exception) . '</p><hr />';
    }
  }
  error_log($exception);
}

© 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_shutdown_function_handle_exception/8.1.x