PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/oiserver/lib/symfony/exception/sfError404Exception.class.php

http://openirudi.googlecode.com/
PHP | 52 lines | 27 code | 6 blank | 19 comment | 4 complexity | 35b530d3aa264413f2da935eb2bca96e MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-3.0
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * sfError404Exception is thrown when a 404 error occurs in an action.
  11. *
  12. * @package symfony
  13. * @subpackage exception
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. * @version SVN: $Id: sfError404Exception.class.php 11471 2008-09-12 10:03:49Z fabien $
  16. */
  17. class sfError404Exception extends sfException
  18. {
  19. /**
  20. * Forwards to the 404 action.
  21. */
  22. public function printStackTrace()
  23. {
  24. $exception = is_null($this->wrappedException) ? $this : $this->wrappedException;
  25. if (sfConfig::get('sf_debug') && !sfConfig::get('sf_test'))
  26. {
  27. $response = sfContext::getInstance()->getResponse();
  28. if (is_null($response))
  29. {
  30. $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
  31. sfContext::getInstance()->setResponse($response);
  32. }
  33. $response->setStatusCode(404);
  34. return parent::printStackTrace();
  35. }
  36. else
  37. {
  38. // log all exceptions in php log
  39. if (!sfConfig::get('sf_test'))
  40. {
  41. error_log($this->getMessage());
  42. }
  43. sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action'));
  44. }
  45. }
  46. }