Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
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 / 4
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 / 1
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    /**
20     * @param ZError $error
21     */
22    public function __construct( private readonly ZError $error ) {
23        // We call the parent construction passing a message so that it can give some information
24        // if the exception is called and printed in php
25        parent::__construct( $error->getMessage() );
26    }
27
28    /**
29     * @return ZError
30     */
31    public function getZError(): ZError {
32        return $this->error;
33    }
34
35    /**
36     * @return ZObject
37     */
38    public function getZErrorMessage(): ZObject {
39        return $this->error->getZValue();
40    }
41
42    /**
43     * @return string
44     */
45    public function getZErrorType(): string {
46        return $this->error->getZErrorType();
47    }
48}