src/Valkyrja/Debug/ExceptionHandler.php
public function getResponse($exception): Response
    {
        if (! $exception instanceof Throwable) {
            $exception = new Exception($exception);
        }

        $headers    = [];
        $statusCode = StatusCode::INTERNAL_SERVER_ERROR;
        $content    = $this->html(
            $this->getContent($exception),
            $this->getStylesheet()
        );

        if ($exception instanceof HttpException) {
            foreach ($exception->getHeaders() as $name => $value) {
                $headers[$name] = $value;
            }

            $statusCode = $exception->getStatusCode();
        }

        if ($exception instanceof HttpRedirectException) {
            $response = Valkyrja::app()->redirect(
                $exception->getUri(),
                $statusCode,
                $headers
            );
        } else {
            $response = Valkyrja::app()->response(
                $content,
                $statusCode,
                $headers
            );
        }

        $response->setCharset($this->charset);

        return $response;
    }
public function getResponse($exception): Response
    {
        if (! $exception instanceof Throwable) {
            $exception = new Exception($exception);
        }

        $headers    = [];
        $statusCode = StatusCode::INTERNAL_SERVER_ERROR;
        $content    = $this->html(
            $this->getContent($exception),
            $this->getStylesheet()
        );

        if ($exception instanceof HttpException) {
            foreach ($exception->getHeaders() as $name => $value) {
                $headers[$name] = $value;
            }

            $statusCode = $exception->getStatusCode();
        }

        if ($exception instanceof HttpRedirectException) {
            $response = Valkyrja::app()->redirect(
                $exception->getUri(),
                $statusCode,
                $headers
            );
        } else {
            $response = Valkyrja::app()->response(
                $content,
                $statusCode,
                $headers
            );
        }

        $response->setCharset($this->charset);

        return $response;
    }
Get a response from an exception.

@param \Throwable $exception The exception

@return \Valkyrja\Http\Response