function Error::renderExceptionSafe
Same name in other branches
- 9 core/lib/Drupal/Core/Utility/Error.php \Drupal\Core\Utility\Error::renderExceptionSafe()
- 8.9.x core/lib/Drupal/Core/Utility/Error.php \Drupal\Core\Utility\Error::renderExceptionSafe()
- 11.x core/lib/Drupal/Core/Utility/Error.php \Drupal\Core\Utility\Error::renderExceptionSafe()
Renders an exception error message without further exceptions.
Parameters
\Exception|\Throwable $exception: The exception object that was thrown.
Return value
string An error message.
2 calls to Error::renderExceptionSafe()
- _drupal_exception_handler_additional in core/
includes/ bootstrap.inc - Displays any additional errors caught while handling an exception.
- _drupal_shutdown_function_handle_exception in core/
includes/ bootstrap.inc - Displays and logs any errors that may happen during shutdown.
File
-
core/
lib/ Drupal/ Core/ Utility/ Error.php, line 107
Class
- Error
- Drupal error utility class.
Namespace
Drupal\Core\UtilityCode
public static function renderExceptionSafe($exception) {
$decode = static::decodeException($exception);
$backtrace = $decode['backtrace'];
unset($decode['backtrace'], $decode['exception']);
// Remove 'main()'.
array_shift($backtrace);
// Even though it is possible that this method is called on a public-facing
// site, it is only called when the exception handler itself threw an
// exception, which normally means that a code change caused the system to
// no longer function correctly (as opposed to a user-triggered error), so
// we assume that it is safe to include a verbose backtrace.
$decode['@backtrace'] = Error::formatBacktrace($backtrace);
return new FormattableMarkup(Error::DEFAULT_ERROR_MESSAGE . ' <pre class="backtrace">@backtrace</pre>', $decode);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.