Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ExtensionError
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
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
6
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Ext;
5
6use Exception;
7use Wikimedia\Parsoid\NodeData\DataMwError;
8
9/**
10 * Exception thrown to halt extension tag content parsing and produce standard
11 * error output.
12 *
13 * $key and $params are basically the arguments to wfMessage, although they
14 * will be stored in the data-mw of the encapsulation wrapper.
15 *
16 * See https://www.mediawiki.org/wiki/Specs/HTML#Error_handling
17 */
18class ExtensionError extends Exception {
19
20    public readonly DataMwError $err;
21
22    /**
23     * @param DataMwError|string $key
24     * @param mixed ...$params
25     */
26    public function __construct(
27        DataMwError|string $key = 'mw-extparse-error', ...$params
28    ) {
29        parent::__construct();
30        $this->err = $key instanceof DataMwError ? $key : new DataMwError( $key, $params );
31    }
32
33}