$this->mCodestr = $codestr;
$this->mExtraData = $extradata;
+ if ( !$this instanceof ApiUsageException ) {
+ wfDeprecated( __METHOD__, '1.29' );
+ }
+
// This should never happen, so throw an exception about it that will
// hopefully get logged with a backtrace (T138585)
if ( !is_string( $codestr ) || $codestr === '' ) {
* @return string
*/
public function getCodeString() {
+ wfDeprecated( __METHOD__, '1.29' );
return $this->mCodestr;
}
* @return array
*/
public function getMessageArray() {
+ wfDeprecated( __METHOD__, '1.29' );
$result = [
'code' => $this->mCodestr,
'info' => $this->getMessage()
* starts throwing ApiUsageException. Eventually UsageException will go away
* and this will (probably) extend MWException directly.
*/
-class ApiUsageException extends UsageException {
+class ApiUsageException extends UsageException implements ILocalizedException {
protected $modulePath;
protected $status;
* @inheritdoc
*/
public function getCodeString() {
+ wfDeprecated( __METHOD__, '1.29' );
return $this->getApiMessage()->getApiCode();
}
* @inheritdoc
*/
public function getMessageArray() {
+ wfDeprecated( __METHOD__, '1.29' );
$enMsg = clone $this->getApiMessage();
$enMsg->inLanguage( 'en' )->useDatabase( false );
] + $enMsg->getApiData();
}
+ /**
+ * @inheritdoc
+ */
+ public function getMessageObject() {
+ return $this->status->getMessage();
+ }
+
/**
* @return string
*/