Exception.php 892 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Swift Mailer Logging Layer Interface
  4. * Please read the LICENSE file
  5. * @author Chris Corbyn <chris@w3style.co.uk>
  6. * @package Swift_Log
  7. * @license GNU Lesser General Public License
  8. */
  9. require_once dirname(__FILE__) . "/ClassLoader.php";
  10. Swift_ClassLoader::load("Swift_LogContainer");
  11. /**
  12. * The Logger Interface
  13. * @package Swift_Log
  14. * @author Chris Corbyn <chris@w3style.co.uk>
  15. */
  16. class Swift_Exception extends Exception
  17. {
  18. /**
  19. * Constructor.
  20. * Creates the exception and appends log information if available.
  21. * @param string Message
  22. * @param int Code
  23. */
  24. public function __construct($message, $code = 0)
  25. {
  26. if (($log = Swift_LogContainer::getLog()) && $log->isEnabled())
  27. {
  28. $message .= "<h3>Log Information</h3>";
  29. $message .= "<pre>" . htmlentities($log->dump(true)) . "</pre>";
  30. }
  31. parent::__construct($message, $code);
  32. }
  33. }