Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
VultrException | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getHTTPCode | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Vultr\VultrPhp; |
6 | |
7 | use Exception; |
8 | use Throwable; |
9 | |
10 | class VultrException extends Exception |
11 | { |
12 | public const DEFAULT_CODE = 200; |
13 | public const SERVICE_CODE = 300; |
14 | public const CLIENT_CODE = 400; |
15 | |
16 | protected ?int $http_code = null; |
17 | |
18 | public function __construct(string $message, int $code = self::DEFAULT_CODE, ?int $http_code = null, ?Throwable $previous = null) |
19 | { |
20 | $this->http_code = $http_code; |
21 | parent::__construct($message, $code, $previous); |
22 | } |
23 | |
24 | public function getHTTPCode() : ?int |
25 | { |
26 | return $this->http_code; |
27 | } |
28 | } |