@@ 15-31 (lines=17) @@ | ||
12 | use Shapin\Stripe\Exception\DomainException; |
|
13 | use Symfony\Contracts\HttpClient\ResponseInterface; |
|
14 | ||
15 | class BadRequestException extends \Exception implements DomainException |
|
16 | { |
|
17 | protected $response; |
|
18 | ||
19 | public function __construct(ResponseInterface $response) |
|
20 | { |
|
21 | $this->response = $response; |
|
22 | $content = json_decode($response->getContent(false), true); |
|
23 | ||
24 | parent::__construct($content['error']['message']); |
|
25 | } |
|
26 | ||
27 | public function getResponse(): ResponseInterface |
|
28 | { |
|
29 | return $this->response; |
|
30 | } |
|
31 | } |
|
32 |
@@ 15-31 (lines=17) @@ | ||
12 | use Shapin\Stripe\Exception\DomainException; |
|
13 | use Symfony\Contracts\HttpClient\ResponseInterface; |
|
14 | ||
15 | final class UnknownErrorException extends \Exception implements DomainException |
|
16 | { |
|
17 | protected $response; |
|
18 | ||
19 | public function __construct(ResponseInterface $response) |
|
20 | { |
|
21 | $this->response = $response; |
|
22 | $content = json_decode($response->getContent(false), true); |
|
23 | ||
24 | parent::__construct($content['error']['message']); |
|
25 | } |
|
26 | ||
27 | public function getResponse(): ResponseInterface |
|
28 | { |
|
29 | return $this->response; |
|
30 | } |
|
31 | } |
|
32 |