src/Listener/ExceptionListener.php
public function getErrorCodePage($statusCode)
    {
        if (!$this->hasErrorCode($statusCode)) {
            throw new InternalErrorException(sprintf('There is not page configured to handle the status code %d', $statusCode));
        }

        $cms = $this->cmsManagerSelector->retrieve();
        $site = $this->siteSelector->retrieve();

        if (!$site) {
            throw new \RuntimeException('No site available');
        }

        return $cms->getPageByRouteName($site, $this->httpErrorCodes[$statusCode]);
    }
public function getErrorCodePage($statusCode)
    {
        if (!$this->hasErrorCode($statusCode)) {
            throw new InternalErrorException(sprintf('There is not page configured to handle the status code %d', $statusCode));
        }

        $cms = $this->cmsManagerSelector->retrieve();
        $site = $this->siteSelector->retrieve();

        if (!$site) {
            throw new \RuntimeException('No site available');
        }

        return $cms->getPageByRouteName($site, $this->httpErrorCodes[$statusCode]);
    }
public function getErrorCodePage ( $ statusCode ) { if ( ! $ this -> hasErrorCode ( $ statusCode ) ) { throw new InternalErrorException ( sprintf ( 'There is not page configured to handle the status code %d' , $ statusCode ) ) ; } $ cms = $ this -> cmsManagerSelector -> retrieve ( ) ; $ site = $ this -> siteSelector -> retrieve ( ) ; if ( ! $ site ) { throw new \ RuntimeException ( 'No site available' ) ; } return $ cms -> getPageByRouteName ( $ site , $ this -> httpErrorCodes [ $ statusCode ] ) ; }
Returns a fully loaded page from a route name by the http error code throw.

@param int $statusCode

@throws \RuntimeException      When site is not found, check your state database
@throws InternalErrorException When you do not configure page for http error code

@return \Sonata\PageBundle\Model\PageInterface
Returns a fully loaded page from a route name by the http error code throw .