Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| ZErrorException | |
0.00% |
0 / 5 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getZError | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getZErrorMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getZErrorType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * WikiLambda extension Exception wrapper for a ZError object |
| 4 | * |
| 5 | * @file |
| 6 | * @ingroup Extensions |
| 7 | * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt |
| 8 | * @license MIT |
| 9 | */ |
| 10 | |
| 11 | namespace MediaWiki\Extension\WikiLambda; |
| 12 | |
| 13 | use Exception; |
| 14 | use MediaWiki\Extension\WikiLambda\ZObjects\ZError; |
| 15 | use MediaWiki\Extension\WikiLambda\ZObjects\ZObject; |
| 16 | |
| 17 | class ZErrorException extends Exception { |
| 18 | |
| 19 | private ZError $error; |
| 20 | |
| 21 | /** |
| 22 | * @param ZError $error |
| 23 | */ |
| 24 | public function __construct( $error ) { |
| 25 | // We call the parent construction passing a message so that it can give some information |
| 26 | // if the exception is called and printed in php |
| 27 | parent::__construct( $error->getMessage() ); |
| 28 | $this->error = $error; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * @return ZError |
| 33 | */ |
| 34 | public function getZError(): ZError { |
| 35 | return $this->error; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @return ZObject |
| 40 | */ |
| 41 | public function getZErrorMessage(): ZObject { |
| 42 | return $this->error->getZValue(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @return string |
| 47 | */ |
| 48 | public function getZErrorType(): string { |
| 49 | return $this->error->getZErrorType(); |
| 50 | } |
| 51 | } |