| 1 |
<?php |
| 2 |
declare( strict_types = 1 ); |
| 3 |
|
| 4 |
namespace Wikimedia\Parsoid\Ext; |
| 5 |
|
| 6 |
use Exception; |
| 7 |
use 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 |
*/ |
| 18 |
class ExtensionError extends Exception { |
| 19 |
|
| 20 |
/** |
| 21 |
* @var DataMwError |
| 22 |
*/ |
| 23 |
public $err; |
| 24 |
|
| 25 |
/** |
| 26 |
* @param string $key |
| 27 |
* @param mixed ...$params |
| 28 |
*/ |
| 29 |
public function __construct( |
| 30 |
string $key = 'mw-extparse-error', ...$params |
| 31 |
) { |
| 32 |
parent::__construct(); |
| 33 |
$this->err = new DataMwError( $key, $params ); |
| 34 |
} |
| 35 |
|
| 36 |
} |