1: | <?php |
2: | namespace Worldline\Connect\Sdk\Communication; |
3: | |
4: | use RuntimeException; |
5: | use Worldline\Connect\Sdk\Domain\DataObject; |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | class ErrorResponseException extends RuntimeException |
13: | { |
14: | |
15: | private $httpStatusCode; |
16: | |
17: | |
18: | |
19: | |
20: | private $errorResponse; |
21: | |
22: | |
23: | |
24: | |
25: | |
26: | |
27: | public function __construct($httpStatusCode, DataObject $errorResponse, $message = null) |
28: | { |
29: | if (is_null($message)) { |
30: | $message = 'The server returned an error.'; |
31: | } |
32: | parent::__construct($message); |
33: | $this->httpStatusCode = $httpStatusCode; |
34: | $this->errorResponse = $errorResponse; |
35: | } |
36: | |
37: | |
38: | |
39: | |
40: | public function getHttpStatusCode() |
41: | { |
42: | return $this->httpStatusCode; |
43: | } |
44: | |
45: | |
46: | |
47: | |
48: | public function getErrorResponse() |
49: | { |
50: | return $this->errorResponse; |
51: | } |
52: | } |
53: | |