Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/184101

Change subject: MWException -> Exception
......................................................................

MWException -> Exception

Change-Id: I7ef55431fe54b452c5b400377bb9fc8bd6ba8ef6
---
M SecurePoll.alias.php
M cli/wm-scripts/bv2013/doSpam.php
M includes/ballots/Ballot.php
M includes/ballots/RadioRangeBallot.php
M includes/crypt/Crypt.php
M includes/crypt/Random.php
M includes/entities/Election.php
M includes/jobs/PopulateVoterListJob.php
M includes/main/SecurePollContentHandler.php
M includes/main/Store.php
M includes/pages/CreatePage.php
M includes/pages/TranslatePage.php
M includes/pages/VotePage.php
M includes/pages/VoterEligibilityPage.php
M includes/talliers/ElectionTallier.php
M includes/talliers/HistogramRangeTallier.php
M includes/talliers/RandomPrefVoteTallier.php
M includes/talliers/Tallier.php
M includes/user/Auth.php
19 files changed, 37 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll 
refs/changes/01/184101/1

diff --git a/SecurePoll.alias.php b/SecurePoll.alias.php
index bc026d9..39143bd 100644
--- a/SecurePoll.alias.php
+++ b/SecurePoll.alias.php
@@ -227,4 +227,4 @@
 /** Traditional Chinese (中文(繁體)‎) */
 $specialPageAliases['zh-hant'] = array(
        'SecurePoll' => array( '安全投票' ),
-);
\ No newline at end of file
+);
diff --git a/cli/wm-scripts/bv2013/doSpam.php b/cli/wm-scripts/bv2013/doSpam.php
index b7e35cd..9368324 100644
--- a/cli/wm-scripts/bv2013/doSpam.php
+++ b/cli/wm-scripts/bv2013/doSpam.php
@@ -109,7 +109,7 @@
                if ( count( $pendingChecks ) > 0 ) {
                        runChecks( $w, $pendingChecks );
                }
-       } catch ( MWException $excep ) {
+       } catch ( Exception $excep ) {
                fwrite( $err, "Error in query: ".$excep->getMessage()."\n" );
        }
 }
diff --git a/includes/ballots/Ballot.php b/includes/ballots/Ballot.php
index 4f9a178..9a16c94 100644
--- a/includes/ballots/Ballot.php
+++ b/includes/ballots/Ballot.php
@@ -20,7 +20,7 @@
         * @return array
         */
        static function getTallyTypes() {
-               throw new MWException( "Subclass must override 
::getTallyTypes()" );
+               throw new Exception( "Subclass must override ::getTallyTypes()" 
);
        }
 
        /**
@@ -129,12 +129,12 @@
         * @param $context SecurePoll_Context
         * @param $type string
         * @param $election SecurePoll_Election
-        * @throws MWException
+        * @throws Exception
         * @return SecurePoll_Ballot
         */
        static function factory( $context, $type, $election ) {
                if ( !isset( self::$ballotTypes[$type] ) ) {
-                       throw new MWException( "Invalid ballot type: $type" );
+                       throw new Exception( "Invalid ballot type: $type" );
                }
                $class = self::$ballotTypes[$type];
                return new $class( $context, $election );
diff --git a/includes/ballots/RadioRangeBallot.php 
b/includes/ballots/RadioRangeBallot.php
index 5e3524d..4bed6ce 100644
--- a/includes/ballots/RadioRangeBallot.php
+++ b/includes/ballots/RadioRangeBallot.php
@@ -105,13 +105,13 @@
        /**
         * @param $question SecurePoll_Question
         * @return array
-        * @throws MWException
+        * @throws Exception
         */
        function getMinMax( $question ) {
                $min = intval( $question->getProperty( 'min-score' ) );
                $max = intval( $question->getProperty( 'max-score' ) );
                if ( $max <= $min ) {
-                       throw new MWException( __METHOD__.': min/max not 
configured' );
+                       throw new Exception( __METHOD__.': min/max not 
configured' );
                }
                return array( $min, $max );
        }
@@ -119,7 +119,7 @@
        /**
         * @param $question SecurePoll_Question
         * @return int
-        * @throws MWException
+        * @throws Exception
         */
        function getColumnDirection( $question ) {
                $order = $question->getProperty( 'column-order' );
@@ -130,7 +130,7 @@
                } elseif ( preg_match( '/^desc/i', $order ) ) {
                        return -1;
                } else {
-                       throw new MWException( __METHOD__.': column-order 
configured incorrectly' );
+                       throw new Exception( __METHOD__.': column-order 
configured incorrectly' );
                }
        }
 
diff --git a/includes/crypt/Crypt.php b/includes/crypt/Crypt.php
index d4d5a40..f77f7c3 100644
--- a/includes/crypt/Crypt.php
+++ b/includes/crypt/Crypt.php
@@ -36,7 +36,7 @@
         */
        static function factory( $context, $type, $election ) {
                if ( !isset( self::$cryptTypes[$type] ) ) {
-                       throw new MWException( "Invalid crypt type: $type" );
+                       throw new Exception( "Invalid crypt type: $type" );
                }
                $class = self::$cryptTypes[$type];
                return $class ? new $class( $context, $election ) : false;
@@ -190,7 +190,7 @@
                # Fetch the keys
                $encryptKey = strval( $this->election->getProperty( 
'gpg-encrypt-key' ) );
                if ( $encryptKey === '' ) {
-                       throw new MWException( 'GPG keys are configured 
incorrectly' );
+                       throw new Exception( 'GPG keys are configured 
incorrectly' );
                }
 
                # Import the encryption key
diff --git a/includes/crypt/Random.php b/includes/crypt/Random.php
index 128d0fe..ea4074d 100644
--- a/includes/crypt/Random.php
+++ b/includes/crypt/Random.php
@@ -43,7 +43,7 @@
                }
                $data = fread( $this->urandom, $numBytes );
                if ( strlen( $data ) != $numBytes ) {
-                       throw new MWException( __METHOD__.': not enough bytes' 
);
+                       throw new Exception( __METHOD__.': not enough bytes' );
                }
                $x = 0;
                for ( $i = 0; $i < $numBytes; $i++ ) {
diff --git a/includes/entities/Election.php b/includes/entities/Election.php
index 713d3c9..1fa858f 100644
--- a/includes/entities/Election.php
+++ b/includes/entities/Election.php
@@ -318,7 +318,7 @@
        /**
         * Get the cryptography module for this election, or false if none is
         * defined.
-        * @throws MWException
+        * @throws Exception
         * @return SecurePoll_Crypt|bool
         */
        function getCrypt() {
@@ -328,7 +328,7 @@
                }
                $crypt = $this->context->newCrypt( $type, $this );
                if ( !$crypt ) {
-                       throw new MWException( 'Invalid encryption type' );
+                       throw new Exception( 'Invalid encryption type' );
                }
                return $crypt;
        }
diff --git a/includes/jobs/PopulateVoterListJob.php 
b/includes/jobs/PopulateVoterListJob.php
index 0d50e9f..36bf39b 100644
--- a/includes/jobs/PopulateVoterListJob.php
+++ b/includes/jobs/PopulateVoterListJob.php
@@ -352,8 +352,8 @@
 
                        $next = $max;
                } catch ( Exception $ex ) {
-                       if ( $ex instanceof MWException ) {
-                               MWExceptionHandler::logException( $ex );
+                       if ( $ex instanceof Exception ) {
+                               ExceptionHandler::logException( $ex );
                        }
                        if ( $dbwMaster ) {
                                try {
diff --git a/includes/main/SecurePollContentHandler.php 
b/includes/main/SecurePollContentHandler.php
index 236ecfb..8e77504 100644
--- a/includes/main/SecurePollContentHandler.php
+++ b/includes/main/SecurePollContentHandler.php
@@ -137,7 +137,7 @@
                                $data['questions'][] = $q;
                        }
                } else {
-                       throw new MWException( __METHOD__ . ': Unsupported 
subpage format' );
+                       throw new Exception( __METHOD__ . ': Unsupported 
subpage format' );
                }
 
                return $data;
diff --git a/includes/main/Store.php b/includes/main/Store.php
index 9782dbe..56ec214 100644
--- a/includes/main/Store.php
+++ b/includes/main/Store.php
@@ -333,12 +333,12 @@
        }
 
        function decodeElectionRow( $row ) {
-               throw new MWException( 'Internal error: attempt to use 
decodeElectionRow() with ' .
+               throw new Exception( 'Internal error: attempt to use 
decodeElectionRow() with ' .
                        'a storage class that doesn\'t support it.' );
        }
 
        function getDB() {
-               throw new MWException( 'Internal error: attempt to use getDB() 
when the database ' .
+               throw new Exception( 'Internal error: attempt to use getDB() 
when the database ' .
                        'is disabled.' );
        }
 
diff --git a/includes/pages/CreatePage.php b/includes/pages/CreatePage.php
index 8e89d70..01c07a2 100644
--- a/includes/pages/CreatePage.php
+++ b/includes/pages/CreatePage.php
@@ -31,7 +31,7 @@
                        if ( $jumpUrl ) {
                                $jumpId = $this->election->getProperty( 
'jump-id' );
                                if ( !$jumpId ) {
-                                       throw new MWException( 'Configuration 
error: no jump-id' );
+                                       throw new Exception( 'Configuration 
error: no jump-id' );
                                }
                                $jumpUrl .= "/edit/$jumpId";
                                if ( count( $params ) > 1 ) {
@@ -571,7 +571,7 @@
                                        $dbw->commit();
                                } catch ( Exception $ex ) {
                                        $dbw->rollback();
-                                       MWExceptionHandler::logException( $ex );
+                                       ExceptionHandler::logException( $ex );
                                }
                                $lb->reuseConnection( $dbw );
                        }
diff --git a/includes/pages/TranslatePage.php b/includes/pages/TranslatePage.php
index 240147a..fa057ca 100644
--- a/includes/pages/TranslatePage.php
+++ b/includes/pages/TranslatePage.php
@@ -30,7 +30,7 @@
                if ( $jumpUrl ) {
                        $jumpId = $this->election->getProperty( 'jump-id' );
                        if ( !$jumpId ) {
-                               throw new MWException( 'Configuration error: no 
jump-id' );
+                               throw new Exception( 'Configuration error: no 
jump-id' );
                        }
                        $jumpUrl .= "/edit/$jumpId";
                        if ( count( $params ) > 1 ) {
@@ -269,7 +269,7 @@
                                        }
                                } catch ( Exception $ex ) {
                                        // Log the exception, but don't abort 
the updating of the rest of the jump-wikis
-                                       MWExceptionHandler::logException( $ex );
+                                       ExceptionHandler::logException( $ex );
                                }
                                $lb->reuseConnection( $dbw );
                        }
diff --git a/includes/pages/VotePage.php b/includes/pages/VotePage.php
index f2935d5..36cdbe2 100644
--- a/includes/pages/VotePage.php
+++ b/includes/pages/VotePage.php
@@ -230,11 +230,11 @@
                global $wgOut, $wgUser;
                $url = $this->election->getProperty( 'jump-url' );
                if ( !$url ) {
-                       throw new MWException( 'Configuration error: no 
jump-url' );
+                       throw new Exception( 'Configuration error: no jump-url' 
);
                }
                $id = $this->election->getProperty( 'jump-id' );
                if ( !$id ) {
-                       throw new MWException( 'Configuration error: no 
jump-id' );
+                       throw new Exception( 'Configuration error: no jump-id' 
);
                }
                $url .= "/login/$id";
                wfRunHooks( 'SecurePoll_JumpUrl', array( $this, &$url ) );
diff --git a/includes/pages/VoterEligibilityPage.php 
b/includes/pages/VoterEligibilityPage.php
index d79fea5..94e7a06 100644
--- a/includes/pages/VoterEligibilityPage.php
+++ b/includes/pages/VoterEligibilityPage.php
@@ -37,7 +37,7 @@
                if ( $jumpUrl ) {
                        $jumpId = $this->election->getProperty( 'jump-id' );
                        if ( !$jumpId ) {
-                               throw new MWException( 'Configuration error: no 
jump-id' );
+                               throw new Exception( 'Configuration error: no 
jump-id' );
                        }
                        $jumpUrl .= "/votereligibility/$jumpId";
                        if ( count( $params ) > 1 ) {
@@ -134,7 +134,7 @@
                                if ( $dbname === $localWiki ) {
                                        throw $ex;
                                }
-                               MWExceptionHandler::logException( $ex );
+                               ExceptionHandler::logException( $ex );
                        }
                        if ( $dbname !== $localWiki ) {
                                $lb->reuseConnection( $dbw );
@@ -300,7 +300,7 @@
                                if ( $dbname === $localWiki ) {
                                        throw $ex;
                                }
-                               MWExceptionHandler::logException( $ex );
+                               ExceptionHandler::logException( $ex );
                        }
                        if ( $dbname !== $localWiki ) {
                                $lb->reuseConnection( $dbw );
@@ -865,7 +865,7 @@
                                if ( $dbname === $localWiki ) {
                                        throw $ex;
                                }
-                               MWExceptionHandler::logException( $ex );
+                               ExceptionHandler::logException( $ex );
                        }
                        if ( $dbname !== $localWiki ) {
                                $lb->reuseConnection( $dbw );
diff --git a/includes/talliers/ElectionTallier.php 
b/includes/talliers/ElectionTallier.php
index 4faaea6..fb8c3fc 100644
--- a/includes/talliers/ElectionTallier.php
+++ b/includes/talliers/ElectionTallier.php
@@ -34,7 +34,7 @@
                foreach ( $questions as $question ) {
                        $tallier = $this->context->newTallier( $tallyType, 
$this, $question );
                        if ( !$tallier ) {
-                               throw new MWException( 'Invalid tally type' );
+                               throw new Exception( 'Invalid tally type' );
                        }
                        $this->talliers[$question->getId()] = $tallier;
                }
diff --git a/includes/talliers/HistogramRangeTallier.php 
b/includes/talliers/HistogramRangeTallier.php
index 3c11b06..805a2ab 100644
--- a/includes/talliers/HistogramRangeTallier.php
+++ b/includes/talliers/HistogramRangeTallier.php
@@ -12,7 +12,7 @@
                $this->minScore = intval( $question->getProperty( 'min-score' ) 
);
                $this->maxScore = intval( $question->getProperty( 'max-score' ) 
);
                if ( $this->minScore >= $this->maxScore ) {
-                       throw new MWException( __METHOD__.': 
min-score/max-score configured incorrectly' );
+                       throw new Exception( __METHOD__.': min-score/max-score 
configured incorrectly' );
                }
 
                foreach ( $question->getOptions() as $option ) {
@@ -47,7 +47,7 @@
        function getHtmlResult() {
                $ballot = $this->election->getBallot();
                if ( !is_callable( array( $ballot, 'getColumnLabels' ) ) ) {
-                       throw new MWException( __METHOD__.': ballot type not 
supported by this tallier' );
+                       throw new Exception( __METHOD__.': ballot type not 
supported by this tallier' );
                }
                $optionLabels = array();
                foreach ( $this->question->getOptions() as $option ) {
diff --git a/includes/talliers/RandomPrefVoteTallier.php 
b/includes/talliers/RandomPrefVoteTallier.php
index 8b56f71..023f69f 100644
--- a/includes/talliers/RandomPrefVoteTallier.php
+++ b/includes/talliers/RandomPrefVoteTallier.php
@@ -18,7 +18,7 @@
                $random = $this->context->getRandom();
                $status = $random->open();
                if ( !$status->isOK() ) {
-                       throw new MWException( "Unable to open random device 
for TBRC ranking" );
+                       throw new Exception( "Unable to open random device for 
TBRC ranking" );
                }
 
                # Random ballot round
@@ -41,7 +41,7 @@
                        # Apply its rankings
                        foreach ( $this->optionIds as $oid1 ) {
                                if ( !isset( $ranks[$oid1] ) ) {
-                                       throw new MWException( "Invalid vote 
record, missing option $oid1" );
+                                       throw new Exception( "Invalid vote 
record, missing option $oid1" );
                                }
                                foreach ( $this->optionIds as $oid2 ) {
                                        if ( isset( $marked[$oid1][$oid2] ) ) {
diff --git a/includes/talliers/Tallier.php b/includes/talliers/Tallier.php
index 5d97e9f..c6701db 100644
--- a/includes/talliers/Tallier.php
+++ b/includes/talliers/Tallier.php
@@ -27,11 +27,11 @@
         * @param $electionTallier
         * @param $question
         * @return SecurePoll_Tallier
-        * @throws MWException
+        * @throws Exception
         */
        static function factory( $context, $type, $electionTallier, $question ) 
{
                if ( !isset( self::$tallierTypes[$type] ) ) {
-                       throw new MWException( "Invalid tallier type: $type" );
+                       throw new Exception( "Invalid tallier type: $type" );
                }
                $class = self::$tallierTypes[$type];
                return new $class( $context, $electionTallier, $question );
diff --git a/includes/user/Auth.php b/includes/user/Auth.php
index 2075a27..a2fcd05 100644
--- a/includes/user/Auth.php
+++ b/includes/user/Auth.php
@@ -20,7 +20,7 @@
         */
        static function factory( $context, $type ) {
                if ( !isset( self::$authTypes[$type] ) ) {
-                       throw new MWException( "Invalid authentication type: 
$type" );
+                       throw new Exception( "Invalid authentication type: 
$type" );
                }
                $class = self::$authTypes[$type];
                return new $class( $context );

-- 
To view, visit https://gerrit.wikimedia.org/r/184101
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ef55431fe54b452c5b400377bb9fc8bd6ba8ef6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to