1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- /*
- * This file is part of the symfony package.
- * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
- *
- * 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 <fabien.potencier@symfony-project.com>
- * @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'));
- }
- }
- }
|