Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class ErrorException extends Exception |
||
10 | { |
||
11 | /** |
||
12 | * Creates a new Exception instance. |
||
13 | * |
||
14 | * @param array{message: string, type: ?string, code: ?string} $contents |
||
15 | */ |
||
16 | public function __construct(private readonly array $contents) |
||
17 | { |
||
18 | parent::__construct($contents['message']); |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Returns the error message. |
||
23 | */ |
||
24 | public function getErrorMessage(): string |
||
25 | { |
||
26 | return $this->getMessage(); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Returns the error type. |
||
31 | */ |
||
32 | public function getErrorType(): ?string |
||
33 | { |
||
34 | return $this->contents['type']; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Returns the error type. |
||
39 | */ |
||
40 | public function getErrorCode(): ?string |
||
43 | } |
||
44 | } |
||
45 |