wikimedia/mediawiki-extensions-CirrusSearch

View on GitHub
includes/Parser/QueryStringRegex/SearchQueryParseException.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace CirrusSearch\Parser\QueryStringRegex;

use MediaWiki\Status\Status;

class SearchQueryParseException extends \Exception {
    /**
     * @var string
     */
    private $messageId;

    /**
     * @var array
     */
    private $params;

    public function __construct( string $messageId, ...$params ) {
        parent::__construct( $messageId );
        $this->messageId = $messageId;
        $this->params = $params;
    }

    /**
     * Transform this exception as a Status object containing the message to display to the user
     * @return Status
     */
    public function asStatus(): Status {
        return Status::newFatal( $this->messageId, ...$this->params );
    }
}