PartialShardFailureException.php 649 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Elastica\Exception;
  3. use Elastica\JSON;
  4. use Elastica\Request;
  5. use Elastica\Response;
  6. /**
  7. * Partial shard failure exception.
  8. *
  9. * @author Ian Babrou <ibobrik@gmail.com>
  10. */
  11. class PartialShardFailureException extends ResponseException
  12. {
  13. /**
  14. * Construct Exception.
  15. *
  16. * @param \Elastica\Request $request
  17. * @param \Elastica\Response $response
  18. */
  19. public function __construct(Request $request, Response $response)
  20. {
  21. parent::__construct($request, $response);
  22. $shardsStatistics = $response->getShardsStatistics();
  23. $this->message = JSON::stringify($shardsStatistics);
  24. }
  25. }