diff options
Diffstat (limited to 'MLEB/Translate/src/PageTranslation/ParsingFailure.php')
-rw-r--r-- | MLEB/Translate/src/PageTranslation/ParsingFailure.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/MLEB/Translate/src/PageTranslation/ParsingFailure.php b/MLEB/Translate/src/PageTranslation/ParsingFailure.php new file mode 100644 index 00000000..a3012c7b --- /dev/null +++ b/MLEB/Translate/src/PageTranslation/ParsingFailure.php @@ -0,0 +1,31 @@ +<?php +declare( strict_types = 1 ); + +namespace MediaWiki\Extension\Translate\PageTranslation; + +use RuntimeException; + +/** + * Represents any kind of failure to parse a translatable page source code. + * + * This is an internal exception that includes information to produce translated error messages, but + * actually displaying them to users is handlded by TPException and MediaWiki core. + * + * @author Niklas Laxström + * @license GPL-2.0-or-later + * @since 2020.08 + */ +class ParsingFailure extends RuntimeException { + private $messageSpec; + + public function __construct( string $message, array $messageSpec ) { + parent::__construct( $message ); + $this->messageSpec = $messageSpec; + } + + public function getMessageSpecification(): array { + return $this->messageSpec; + } +} + +class_alias( ParsingFailure::class, '\MediaWiki\Extensions\Translate\ParsingFailure' ); |