$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;
}
/**
- * @returns ApiMessage
+ * @return ApiMessage
*/
private function getApiMessage() {
$errors = $this->status->getErrorsByType( 'error' );
/**
* @deprecated Do not use. This only exists here because UsageException is in
* the inheritance chain for backwards compatibility.
- * @inheritdoc
+ * @inheritDoc
*/
public function getCodeString() {
+ wfDeprecated( __METHOD__, '1.29' );
return $this->getApiMessage()->getApiCode();
}
/**
* @deprecated Do not use. This only exists here because UsageException is in
* the inheritance chain for backwards compatibility.
- * @inheritdoc
+ * @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
*/