2019-07-15 10:24:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MediaWiki\Rest;
|
|
|
|
|
|
|
|
|
|
use Wikimedia\Message\MessageValue;
|
|
|
|
|
|
2020-06-29 12:13:29 +00:00
|
|
|
/**
|
|
|
|
|
* @newable
|
|
|
|
|
*/
|
2019-07-15 10:24:38 +00:00
|
|
|
class LocalizedHttpException extends HttpException {
|
2019-07-16 22:43:43 +00:00
|
|
|
private $messageValue;
|
|
|
|
|
|
2020-06-29 12:13:29 +00:00
|
|
|
/**
|
2020-07-13 08:53:06 +00:00
|
|
|
* @stable to call
|
2020-06-29 12:13:29 +00:00
|
|
|
*
|
|
|
|
|
* @param MessageValue $messageValue
|
|
|
|
|
* @param int $code
|
2020-07-09 14:14:10 +00:00
|
|
|
* @param array|null $errorData
|
2020-06-29 12:13:29 +00:00
|
|
|
*/
|
2019-09-12 17:44:11 +00:00
|
|
|
public function __construct( MessageValue $messageValue, $code = 500, $errorData = null ) {
|
|
|
|
|
parent::__construct(
|
|
|
|
|
'Localized exception with key ' . $messageValue->getKey(), $code, $errorData
|
|
|
|
|
);
|
2019-07-16 22:43:43 +00:00
|
|
|
$this->messageValue = $messageValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMessageValue() {
|
|
|
|
|
return $this->messageValue;
|
2019-07-15 10:24:38 +00:00
|
|
|
}
|
|
|
|
|
}
|