Made Database atomic section errors mention the sections
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 7 Oct 2015 19:31:04 +0000 (12:31 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 7 Oct 2015 19:31:04 +0000 (12:31 -0700)
Change-Id: Ia6243dd655ef09f3bfbc66ac6d0757ec7bb4bd10

includes/db/Database.php

index b9d344f..811a4a7 100644 (file)
@@ -3426,8 +3426,10 @@ abstract class DatabaseBase implements IDatabase {
                        if ( $this->mTrxAtomicLevels ) {
                                // If the current transaction was an automatic atomic one, then we definitely have
                                // a problem. Same if there is any unclosed atomic level.
-                               throw new DBUnexpectedError( $this,
-                                       "Attempted to start explicit transaction when atomic levels are still open."
+                               $levels = implode( ', ', $this->mTrxAtomicLevels );
+                               throw new DBUnexpectedError(
+                                       $this,
+                                       "Got explicit BEGIN while atomic sections $levels are still open."
                                );
                        } elseif ( !$this->mTrxAutomatic ) {
                                // We want to warn about inadvertently nested begin/commit pairs, but not about
@@ -3510,9 +3512,10 @@ abstract class DatabaseBase implements IDatabase {
        final public function commit( $fname = __METHOD__, $flush = '' ) {
                if ( $this->mTrxLevel && $this->mTrxAtomicLevels ) {
                        // There are still atomic sections open. This cannot be ignored
+                       $levels = implode( ', ', $this->mTrxAtomicLevels );
                        throw new DBUnexpectedError(
                                $this,
-                               "Attempted to commit transaction while atomic sections are still open"
+                               "Got COMMIT while atomic sections $levels are still open"
                        );
                }