Mirror of https://gerrit.wikimedia.org/g/mediawiki/libs/NormalizedException See https://www.mediawiki.org/wiki/Developer_access for contributing.
MIT License
A minimal library to facilitate PSR-3-friendly exception handling.
Additional documentation about the library can be found on MediaWiki.org.
Use the standard implementation:
use Wikimedia\NormalizedException\NormalizedException;
throw new NormalizedException( 'Invalid value: {value}', [ 'value' => $value ] );
Integrate into another framework or library:
use Wikimedia\NormalizedException\INormalizedException;
use Wikimedia\NormalizedException\NormalizedExceptionTrait;
class MyException extends SomeException implements INormalizedException {
use NormalizedExceptionTrait;
public function __construct( string $normalizedMessage, array $messageContext = [] ) {
$this->normalizedMessage = $normalizedMessage;
$this->messageContext = $messageContext;
parent::__construct(
self::getMessageFromNormalizedMessage( $normalizedMessage, $messageContext )
);
}
}
throw new MyException( 'Invalid value: {value}', [ 'value' => $value ] );
composer install --dev
composer test
This library was split out of MediaWiki changeset 670465 during the MediaWiki 1.37 development cycle.