AbortedMultiExecException.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Transaction;
  11. use Predis\PredisException;
  12. /**
  13. * Exception class that identifies MULTI / EXEC transactions aborted by Redis.
  14. *
  15. * @author Daniele Alessandri <suppakilla@gmail.com>
  16. */
  17. class AbortedMultiExecException extends PredisException
  18. {
  19. private $transaction;
  20. /**
  21. * @param MultiExecContext $transaction Transaction that generated the exception.
  22. * @param string $message Error message.
  23. * @param int $code Error code.
  24. */
  25. public function __construct(MultiExecContext $transaction, $message, $code = null)
  26. {
  27. parent::__construct($message, $code);
  28. $this->transaction = $transaction;
  29. }
  30. /**
  31. * Returns the transaction that generated the exception.
  32. *
  33. * @return MultiExecContext
  34. */
  35. public function getTransaction()
  36. {
  37. return $this->transaction;
  38. }
  39. }