Contao\CoreBundle\EventListener\PrettyErrorScreenListener::getResponseFromPageHandler PHP Method

getResponseFromPageHandler() private method

Returns the response of a Contao page handler.
private getResponseFromPageHandler ( string $type ) : Response | null
$type string
return Symfony\Component\HttpFoundation\Response | null
    private function getResponseFromPageHandler($type)
    {
        $type = 'error_' . $type;
        if (!isset($GLOBALS['TL_PTY'][$type]) || !class_exists($GLOBALS['TL_PTY'][$type])) {
            return null;
        }
        /** @var PageError404 $pageHandler */
        $pageHandler = new $GLOBALS['TL_PTY'][$type]();
        try {
            return $pageHandler->getResponse();
        } catch (RedirectResponseException $e) {
            return $e->getResponse();
        } catch (\Exception $e) {
            return null;
        }
    }