* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * sfError404Exception is thrown when a 404 error occurs in an action. * * @package symfony * @subpackage exception * @author Fabien Potencier * @version SVN: $Id: sfError404Exception.class.php 11471 2008-09-12 10:03:49Z fabien $ */ class sfError404Exception extends sfException { /** * Forwards to the 404 action. */ public function printStackTrace() { $exception = is_null($this->wrappedException) ? $this : $this->wrappedException; if (sfConfig::get('sf_debug') && !sfConfig::get('sf_test')) { $response = sfContext::getInstance()->getResponse(); if (is_null($response)) { $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher()); sfContext::getInstance()->setResponse($response); } $response->setStatusCode(404); return parent::printStackTrace(); } else { // log all exceptions in php log if (!sfConfig::get('sf_test')) { error_log($this->getMessage()); } sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action')); } } }