Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
ZErrorException
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getZError
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getZErrorMessage
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getZErrorType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
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
11namespace MediaWiki\Extension\WikiLambda;
12
13use Exception;
14use MediaWiki\Extension\WikiLambda\ZObjects\ZError;
15use MediaWiki\Extension\WikiLambda\ZObjects\ZObject;
16
17class ZErrorException extends Exception {
18
19    /** @var ZError */
20    private $error;
21
22    /**
23     * @param ZError $error
24     */
25    public function __construct( $error ) {
26        // We call the parent construction passing a message so that it can give some information
27        // if the exception is called and printed in php
28        parent::__construct( $error->getMessage() );
29        $this->error = $error;
30    }
31
32    /**
33     * @return ZError
34     */
35    public function getZError(): ZError {
36        return $this->error;
37    }
38
39    /**
40     * @return ZObject
41     */
42    public function getZErrorMessage(): ZObject {
43        return $this->error->getZValue();
44    }
45
46    /**
47     * @return string
48     */
49    public function getZErrorType(): string {
50        return $this->error->getZErrorType();
51    }
52}