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 | private array $errorData; |
15 | |
16 | /** |
17 | * @stable to call |
18 | * |
19 | * @param string $message |
20 | * @param int $code |
21 | * @param array $errorData |
22 | */ |
23 | public function __construct( $message, $code = 500, $errorData = [] ) { |
24 | parent::__construct( $message, $code ); |
25 | $this->errorData = $errorData; |
26 | } |
27 | |
28 | public function getErrorData(): array { |
29 | return $this->errorData; |
30 | } |
31 | } |