X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiMain.php;h=b7d452940d151bf326088cbeb42b96102e6b9b86;hp=5cb7967d33bf5f6d50957fb4e56ce2a5e9333f0c;hb=d1cf48a397edbbe9c6a63d6f83861d676f686d07;hpb=946e506a91f4a6f3dbe50c29ab255ea8614a8dce diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 5cb7967d33..b7d452940d 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -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' => [