1. sfError404Exception.class.php
  2. /** * sfError404Exception is thrown when a 404 error occurs in an action. * * @package symfony * @subpackage exception * @author Fabien Potencier * @version SVN: $Id: sfError404Exception.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ */
  3. class sfError404Exception extends sfException
  4. {
  5. /**
  6. * Forwards to the 404 action.
  7. */
  8. public function printStackTrace()
  9. {
  10. $exception = null === $this->wrappedException ? $this : $this->wrappedException;
  11. if (sfConfig::get('sf_debug'))
  12. {
  13. $response = sfContext::getInstance()->getResponse();
  14. if (null === $response)
  15. {
  16. $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
  17. sfContext::getInstance()->setResponse($response);
  18. }
  19. $response->setStatusCode(404);
  20. return parent::printStackTrace();
  21. }
  22. else
  23. {
  24. // log all exceptions in php log
  25. if (!sfConfig::get('sf_test'))
  26. {
  27. error_log($this->getMessage());
  28. }
  29. sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action'));
  30. }
  31. }
  32. }

Debug toolbar