From 3f40c646969cb61a65922011ab87e56802f4385e Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 3 Apr 2015 12:12:30 -0400 Subject: [PATCH] Catch rollback exceptions in API exception handling Like I92293b22, but for the API. Needed for I41508127f fixing ignore handling in the DB. Change-Id: I1f2b70c80c7496f463f678b950c08de22476ea66 --- includes/api/ApiMain.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 1feb485237..297845361d 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -416,7 +416,13 @@ class ApiMain extends ApiBase { // Bug 63145: Rollback any open database transactions if ( !( $e instanceof UsageException ) ) { // UsageExceptions are intentional, so don't rollback if that's the case - MWExceptionHandler::rollbackMasterChangesAndLog( $e ); + 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 ); + } } // Allow extra cleanup and logging -- 2.20.1