build: Update mediawiki/mediawiki-codesniffer to 0.10.1
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index 5cb7967..b7d4529 100644 (file)
@@ -581,23 +581,12 @@ class ApiMain extends ApiBase {
                // T65145: Rollback any open database transactions
                if ( !( $e instanceof ApiUsageException || $e instanceof UsageException ) ) {
                        // UsageExceptions are intentional, so don't rollback if that's the case
-                       try {
-                               MWExceptionHandler::rollbackMasterChangesAndLog( $e );
-                       } catch ( DBError $e2 ) {
-                               // Rollback threw an exception too. Log it, but don't interrupt
-                               // our regularly scheduled exception handling.
-                               MWExceptionHandler::logException( $e2 );
-                       }
+                       MWExceptionHandler::rollbackMasterChangesAndLog( $e );
                }
 
                // Allow extra cleanup and logging
                Hooks::run( 'ApiMain::onException', [ $this, $e ] );
 
-               // Log it
-               if ( !( $e instanceof ApiUsageException || $e instanceof UsageException ) ) {
-                       MWExceptionHandler::logException( $e );
-               }
-
                // Handle any kind of exception by outputting properly formatted error message.
                // If this fails, an unhandled exception should be thrown so that global error
                // handler will process and log it.
@@ -1052,7 +1041,7 @@ class ApiMain extends ApiBase {
                        // None of the rest have any messages for non-error types
                } elseif ( $e instanceof UsageException ) {
                        // User entered incorrect parameters - generate error response
-                       $data = $e->getMessageArray();
+                       $data = MediaWiki\quietCall( [ $e, 'getMessageArray' ] );
                        $code = $data['code'];
                        $info = $data['info'];
                        unset( $data['code'], $data['info'] );
@@ -1840,7 +1829,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_TYPE => 'submodule',
                        ],
                        'format' => [
-                               ApiBase::PARAM_DFLT => ApiMain::API_DEFAULT_FORMAT,
+                               ApiBase::PARAM_DFLT => self::API_DEFAULT_FORMAT,
                                ApiBase::PARAM_TYPE => 'submodule',
                        ],
                        'maxlag' => [