Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ErrorHandler.php

function ErrorHandler::renderException

Renders the given exception.

As this method is mainly called during boot where nothing is yet available, the output is always either HTML or CLI depending where PHP runs.

File

vendor/symfony/error-handler/ErrorHandler.php, line 651

Class

ErrorHandler
A generic ErrorHandler for the PHP engine.

Namespace

Symfony\Component\ErrorHandler

Code

private function renderException(\Throwable $exception) : void {
    $renderer = \in_array(\PHP_SAPI, [
        'cli',
        'phpdbg',
        'embed',
    ], true) ? new CliErrorRenderer() : new HtmlErrorRenderer($this->debug);
    $exception = $renderer->render($exception);
    if (!headers_sent()) {
        http_response_code($exception->getStatusCode());
        foreach ($exception->getHeaders() as $name => $value) {
            header($name . ': ' . $value, false);
        }
    }
    echo $exception->getAsString();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal