Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
HttpException | |
0.00% |
0 / 3 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getErrorData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Rest; |
4 | |
5 | /** |
6 | * This is the base exception class for non-fatal exceptions thrown from REST |
7 | * handlers. The exception is not logged, it is merely converted to an |
8 | * error response. |
9 | * |
10 | * @newable |
11 | */ |
12 | class HttpException extends \Exception { |
13 | |
14 | /** @var array */ |
15 | private array $errorData; |
16 | |
17 | /** |
18 | * @stable to call |
19 | * |
20 | * @param string $message |
21 | * @param int $code |
22 | * @param array $errorData |
23 | */ |
24 | public function __construct( $message, $code = 500, $errorData = [] ) { |
25 | parent::__construct( $message, $code ); |
26 | $this->errorData = $errorData; |
27 | } |
28 | |
29 | /** |
30 | * @return array |
31 | */ |
32 | public function getErrorData(): array { |
33 | return $this->errorData; |
34 | } |
35 | } |