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