CompositeException.php 867 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace React\Promise\Exception;
  3. /**
  4. * Represents an exception that is a composite of one or more other exceptions.
  5. *
  6. * This exception is useful in situations where a promise must be rejected
  7. * with multiple exceptions. It is used for example to reject the returned
  8. * promise from `some()` and `any()` when too many input promises reject.
  9. */
  10. class CompositeException extends \Exception
  11. {
  12. /** @var \Throwable[] */
  13. private $throwables;
  14. /** @param \Throwable[] $throwables */
  15. public function __construct(array $throwables, string $message = '', int $code = 0, ?\Throwable $previous = null)
  16. {
  17. parent::__construct($message, $code, $previous);
  18. $this->throwables = $throwables;
  19. }
  20. /**
  21. * @return \Throwable[]
  22. */
  23. public function getThrowables(): array
  24. {
  25. return $this->throwables;
  26. }
  27. }