ExceptionFilter.class.php 609 B

1234567891011121314151617181920212223
  1. <?php
  2. class ExceptionFilter extends sfFilter
  3. {
  4. public function execute($filterChain)
  5. {
  6. try
  7. {
  8. $filterChain->execute();
  9. } catch (sfStopException $e)
  10. {
  11. throw $e;
  12. } catch (sfException $e)
  13. {
  14. $this->getContext()->getLogger()->emerg($e->getMessage());
  15. $response = $this->getContext()->getResponse();
  16. $content = $response->getContent();
  17. $response->setContent(str_ireplace('<body>','<body><div class="error_list">'.$e->getMessage().'</div>',$content));
  18. // $response->setSlot('status_bar','<div class="error_list">'.$e->getMessage().'</div>');
  19. }
  20. }
  21. }