X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiMain.php;h=edc1a3e7e9e516fa079f7e28014433ba929ec326;hb=c8e482371407477ecd4f0a1b5778e565d3963a93;hp=e69300bb3be5ba26ecf3e0960cfea3d76ff6d7a4;hpb=ee58c7b17014f3c97408364c073268272c59693f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index e69300bb3b..edc1a3e7e9 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -125,7 +125,6 @@ class ApiMain extends ApiBase { 'none' => 'ApiFormatNone', ]; - // @codingStandardsIgnoreStart String contenation on "msg" not allowed to break long line /** * List of user roles that are specifically relevant to the API. * [ 'right' => [ 'msg' => 'Some message with a $1', @@ -142,7 +141,6 @@ class ApiMain extends ApiBase { 'params' => [ ApiBase::LIMIT_SML2, ApiBase::LIMIT_BIG2 ] ] ]; - // @codingStandardsIgnoreEnd /** * @var ApiFormatBase @@ -1054,13 +1052,14 @@ class ApiMain extends ApiBase { if ( ( $e instanceof DBQueryError ) && !$config->get( 'ShowSQLErrors' ) ) { $params = [ 'apierror-databaseerror', WebRequest::getRequestId() ]; } else { - $params = [ - 'apierror-exceptioncaught', - WebRequest::getRequestId(), - $e instanceof ILocalizedException - ? $e->getMessageObject() - : wfEscapeWikiText( $e->getMessage() ) - ]; + if ( $e instanceof ILocalizedException ) { + $msg = $e->getMessageObject(); + } elseif ( $e instanceof MessageSpecifier ) { + $msg = Message::newFromSpecifier( $e ); + } else { + $msg = wfEscapeWikiText( $e->getMessage() ); + } + $params = [ 'apierror-exceptioncaught', WebRequest::getRequestId(), $msg ]; } $messages[] = ApiMessage::create( $params, $code ); } @@ -1870,7 +1869,7 @@ class ApiMain extends ApiBase { ]; } - /** @see ApiBase::getExamplesMessages() */ + /** @inheritDoc */ protected function getExamplesMessages() { return [ 'action=help'