public function getContent(Throwable $exception): string
    {
        $title = 'Whoops, looks like something went wrong.';

        if (
            $exception instanceof HttpException
            && $exception->getStatusCode() === 404
        ) {
            $title = 'Sorry, the page you are looking for could not be found.';
        }

        $content = '';

        if ($this->displayErrors) {
            try {
                $exceptions = [
                    $exception,
                ];
                $e          = $exception;

                while ($e = $e->getPrevious()) {
                    $exceptions[] = $e;
                }

                $count = \count($exceptions);
                $total = $count;

                /**
                 * @var int
                 * @var \Throwable $e
                 */
                foreach ($exceptions as $position => $e) {
                    $ind     = $count - $position;
                    $class   = $this->formatClass(\get_class($e));
                    $message = nl2br($this->escapeHtml($e->getMessage()));
                    $content .= sprintf(
                        <<<'EOF'
                                                <h2 class="block_exception clear_fix">
                            <span class="exception_counter">%d/%d</span>
                            <span class="exception_title">%s%s:</span>
                            <span class="exception_message">%s</span>
                        </h2>
                        <div class="block">
                            <ol class="traces list_exception">

EOF
                        ,
                        $ind,
                        $total,
                        $class,
                        $this->formatPath(
                            $e->getTrace()[0]['file'] ?? 'Unknown file',
                            $e->getTrace()[0]['line'] ?? 0
                        ),
                        $message
                    );

                    foreach ($e->getTrace() as $trace) {
                        $traceClass    = $trace['class'] ?? '';
                        $traceArgs     = $trace['args'] ?? [];
                        $traceType     = $trace['type'] ?? '';
                        $traceFunction = $trace['function'] ?? '';

                        $content .= '       <li>';

                        if ($trace['function']) {
                            $content .= sprintf(
                                'at %s%s%s(%s)',
                                $this->formatClass($traceClass),
                                $traceType,
                                $traceFunction,
                                $this->formatArgs($traceArgs)
                            );
                        }

                        if (isset($trace['file'], $trace['line'])) {
                            $content .= $this->formatPath(
                                $trace['file'],
                                $trace['line']
                            );
                        }

                        $content .= "</li>\n";
                    }

                    $content .= "    </ol>\n</div>\n";
                }
            } catch (Exception $e) {
                // Something nasty happened and we cannot throw an exception anymore
                $title = sprintf(
                    'Exception thrown when handling an exception (%s: %s)',
                    \get_class($e),
                    $this->escapeHtml($e->getMessage())
                );
            }
        }

        return <<<EOF
            <div id="sf-resetcontent" class="sf-reset">
                <h1>$title</h1>
                $content
            </div>
EOF;
    }