Ori.livneh has uploaded a new change for review.

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

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

MWException -> Exception

Change-Id: I353047bf79f578afd8b44fe01b1cae8c960fd9ac
---
M Echo.alias.php
M Hooks.php
M controller/NotificationController.php
M formatters/BasicFormatter.php
M formatters/NotificationFormatter.php
M includes/BatchRowUpdate.php
M includes/ContainmentSet.php
M includes/DiffParser.php
M includes/DiscussionParser.php
M includes/EmailBatch.php
M includes/EmailBundler.php
M includes/NotifUser.php
M includes/exception/CatchableFatalErrorException.php
M includes/iterator/FilteredSequentialIterator.php
M includes/mapper/AbstractMapper.php
M includes/mapper/EventMapper.php
M includes/mapper/NotificationMapper.php
M jobs/NotificationEmailBundleJob.php
M model/Event.php
M model/Notification.php
M model/TargetPage.php
M tests/phpunit/includes/DiscussionParserTest.php
M tests/phpunit/includes/mapper/AbstractMapperTest.php
M tests/phpunit/includes/mapper/EventMapperTest.php
M tests/phpunit/model/NotificationTest.php
M tests/phpunit/model/TargetPageTest.php
26 files changed, 72 insertions(+), 72 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/20/184020/1

diff --git a/Echo.alias.php b/Echo.alias.php
index b9ef187..de3be6d 100644
--- a/Echo.alias.php
+++ b/Echo.alias.php
@@ -227,4 +227,4 @@
 /** Traditional Chinese (中文(繁體)‎) */
 $specialPageAliases['zh-hant'] = array(
        'Notifications' => array( '通知' ),
-);
\ No newline at end of file
+);
diff --git a/Hooks.php b/Hooks.php
index c048399..16fa06c 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -233,7 +233,7 @@
         * @param $user User to get preferences for
         * @param &$preferences Preferences array
         *
-        * @throws MWException
+        * @throws Exception
         * @return bool true in all cases
         */
        public static function getPreferences( $user, &$preferences ) {
@@ -375,7 +375,7 @@
 
                $invalid = array_intersect( $forceOptionsOff, $forceOptionsOn );
                if ( $invalid ) {
-                       throw new MWException( sprintf(
+                       throw new Exception( sprintf(
                                'The following notifications are both forced 
and removed: %s',
                                implode( ', ', $invalid )
                        ) );
diff --git a/controller/NotificationController.php 
b/controller/NotificationController.php
index 6ab197d..aea2f4c 100644
--- a/controller/NotificationController.php
+++ b/controller/NotificationController.php
@@ -231,13 +231,13 @@
         * @param EchoEvent $event
         * @param User $user The user to be notified.
         * @param string $type The type of notification delivery to process, 
e.g. 'email'.
-        * @throws MWException
+        * @throws Exception
         */
        public static function doNotification( $event, $user, $type ) {
                global $wgEchoNotifiers;
 
                if ( !isset( $wgEchoNotifiers[$type] ) ) {
-                       throw new MWException( "Invalid notification type 
$type" );
+                       throw new Exception( "Invalid notification type $type" 
);
                }
 
                // Don't send any notification if Echo is disabled
@@ -371,7 +371,7 @@
                                        'exceptionMessage' => $e->getMessage(),
                                );
                                wfDebugLog( 'Echo', __FUNCTION__ . ": Error 
formatting " . FormatJson::encode( $meta ) );
-                               MWExceptionHandler::logException( $e );
+                               ExceptionHandler::logException( $e );
                        }
                        restore_error_handler();
                }
diff --git a/formatters/BasicFormatter.php b/formatters/BasicFormatter.php
index 761c274..bee3e24 100644
--- a/formatters/BasicFormatter.php
+++ b/formatters/BasicFormatter.php
@@ -591,7 +591,7 @@
         * @param EchoEvent
         * @param User
         * @param string deprecated
-        * @throws MWException
+        * @throws Exception
         */
        protected function generateBundleData( $event, $user, $type ) {
                $data = $this->getRawBundleData( $event, $user, $type );
@@ -613,7 +613,7 @@
                                $agents[$agent->getId()] = $agent->getId();
                        }
                } else {
-                       throw new MWException( "Agent is required for bundling 
notification!" );
+                       throw new Exception( "Agent is required for bundling 
notification!" );
                }
 
                // Initialize with 1 for the agent of current event
@@ -854,7 +854,7 @@
         * @param $param string
         * @param $message Message
         * @param $user User
-        * @throws MWException
+        * @throws Exception
         */
        protected function processParam( $event, $param, $message, $user ) {
                if ( $param === 'agent' ) {
@@ -921,7 +921,7 @@
 
                        $message->params( $textNotification );
                } else {
-                       throw new MWException( "Unrecognised parameter $param" 
);
+                       throw new Exception( "Unrecognised parameter $param" );
                }
        }
 
@@ -930,12 +930,12 @@
         *
         * @param $key string
         *
-        * @throws MWException
+        * @throws Exception
         * @return mixed
         */
        public function getValue( $key ) {
                if ( !property_exists( $this, $key ) ) {
-                       throw new MWException( "Call to non-existing property 
$key in " . get_class( $this ) );
+                       throw new Exception( "Call to non-existing property 
$key in " . get_class( $this ) );
                }
                return $this->$key;
        }
diff --git a/formatters/NotificationFormatter.php 
b/formatters/NotificationFormatter.php
index 2604ea3..fcf96ec 100644
--- a/formatters/NotificationFormatter.php
+++ b/formatters/NotificationFormatter.php
@@ -45,7 +45,7 @@
        /**
         * Creates an instance of the given class with the given parameters.
         * @param $parameters array Associative array of parameters
-        * @throws MWException
+        * @throws Exception
         */
        public function __construct( array $parameters ) {
                $this->parameters = $parameters;
@@ -53,7 +53,7 @@
                $missingParameters = array_diff( $this->requiredParameters, 
array_keys( $parameters ) );
 
                if ( $missingParameters ) {
-                       throw new MWException(
+                       throw new Exception(
                                "Missing required parameters for " .
                                        get_class( $this ) . ":" .
                                        implode( " ", $missingParameters )
@@ -74,11 +74,11 @@
        /**
         * Set the output format that the notification will be displayed in.
         * @param $format string A valid output format (by default, 'text', 
'html', 'flyout', and 'email' are allowed)
-        * @throws MWException
+        * @throws Exception
         */
        public function setOutputFormat( $format ) {
                if ( !in_array( $format, $this->validOutputFormats, true ) ) {
-                       throw new MWException( "Invalid output format $format" 
);
+                       throw new Exception( "Invalid output format $format" );
                }
 
                $this->outputFormat = $format;
@@ -97,7 +97,7 @@
         * @param $parameters array Associative array.
         * Select the class of formatter to use with the 'class' field.
         * For other parameters, see the appropriate class' constructor.
-        * @throws MWException
+        * @throws Exception
         * @return EchoNotificationFormatter object.
         */
        public static function factory( $parameters ) {
diff --git a/includes/BatchRowUpdate.php b/includes/BatchRowUpdate.php
index 8838fca..dc86419 100644
--- a/includes/BatchRowUpdate.php
+++ b/includes/BatchRowUpdate.php
@@ -109,11 +109,11 @@
         *
         * @param callable $output A callback taking a single string parameter 
to output
         *
-        * @throws MWException
+        * @throws Exception
         */
        public function setOutput( $output ) {
                if ( !is_callable( $output ) ) {
-                       throw new MWException( 'Provided $output param is 
required to be callable.' );
+                       throw new Exception( 'Provided $output param is 
required to be callable.' );
                }
                $this->output = $output;
        }
@@ -271,11 +271,11 @@
         * @param string|array $primaryKey The name or names of the primary key 
columns
         * @param integer      $batchSize  The number of rows to fetch per 
iteration
         *
-        * @throws MWException
+        * @throws Exception
         */
        public function __construct( DatabaseBase $db, $table, $primaryKey, 
$batchSize ) {
                if ( $batchSize < 1 ) {
-                       throw new MWException( 'Batch size must be at least 1 
row.' );
+                       throw new Exception( 'Batch size must be at least 1 
row.' );
                }
                $this->db = $db;
                $this->table = $table;
diff --git a/includes/ContainmentSet.php b/includes/ContainmentSet.php
index 95c1c8a..11fd0b0 100644
--- a/includes/ContainmentSet.php
+++ b/includes/ContainmentSet.php
@@ -65,13 +65,13 @@
         * @param $cache          BagOStuff An object to cache the page with or 
null for no cache.
         * @param $cacheKeyPrefix string    A prefix to be combined with the 
pages latest revision id and used as a cache key.
         *
-        * @throws MWException
+        * @throws Exception
         */
        public function addOnWiki( $namespace, $title, BagOStuff $cache = null, 
$cacheKeyPrefix = '' ) {
                $list = new EchoOnWikiList( $namespace, $title );
                if ( $cache ) {
                        if ( $cacheKeyPrefix === '' ) {
-                               throw new MWException( 'Cache requires 
providing a cache key prefix.' );
+                               throw new Exception( 'Cache requires providing 
a cache key prefix.' );
                        }
                        $list = new EchoCachedList( $cache, $cacheKeyPrefix, 
$list );
                }
@@ -222,7 +222,7 @@
 
                $result = $this->nestedList->getValues();
                if ( !is_array( $result ) ) {
-                       throw new MWException( sprintf(
+                       throw new Exception( sprintf(
                                "Expected array but received '%s' from 
'%s::getValues'",
                                is_object( $result ) ? get_class( $result ) : 
gettype( $result ),
                                get_class( $this->nestedList )
diff --git a/includes/DiffParser.php b/includes/DiffParser.php
index 9f60c36..171af13 100644
--- a/includes/DiffParser.php
+++ b/includes/DiffParser.php
@@ -151,7 +151,7 @@
         * @param string $line The next line of the unified diff
         * @param EchoDiffGroup $change Changes the the immediately previous 
lines
         *
-        * @throws MWException
+        * @throws Exception
         * @return EchoDiffGroup Changes to this line and any changed lines 
immediately previous
         */
        protected function parseLine( $line, EchoDiffGroup $change = null ) {
@@ -193,7 +193,7 @@
 
                case '-': // subtract
                        if ( $this->left[$this->leftPos] !== $line ) {
-                               throw new MWException( 'Positional error: left' 
);
+                               throw new Exception( 'Positional error: left' );
                        }
                        if ( $change === null ) {
                                $change = new EchoDiffGroup( $this->leftPos, 
$this->rightPos );
@@ -204,7 +204,7 @@
 
                case '+': // add
                        if ( $this->right[$this->rightPos] !== $line ) {
-                               throw new MWException( 'Positional error: 
right' );
+                               throw new Exception( 'Positional error: right' 
);
                        }
                        if ( $change === null ) {
                                $change = new EchoDiffGroup( $this->leftPos, 
$this->rightPos );
@@ -214,7 +214,7 @@
                        break;
 
                default:
-                       throw new MWException( 'Unknown Diff Operation: ' . $op 
);
+                       throw new Exception( 'Unknown Diff Operation: ' . $op );
                }
 
                return $change;
diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php
index bb227d1..74a06b0 100644
--- a/includes/DiscussionParser.php
+++ b/includes/DiscussionParser.php
@@ -596,7 +596,7 @@
         *
         * @param $oldText string The "left hand side" of the diff.
         * @param $newText string The "right hand side" of the diff.
-        * @throws MWException
+        * @throws Exception
         * @return Array of changes.
         * Each change consists of:
         * * An 'action', one of:
@@ -842,7 +842,7 @@
         * Gets a regular expression that will match this wiki's
         * timestamps as given by ~~~~.
         *
-        * @throws MWException
+        * @throws Exception
         * @return String regular expression fragment.
         */
        static function getTimestampRegex() {
@@ -876,7 +876,7 @@
                }
 
                if ( !preg_match( "/$output/u", $exemplarTimestamp ) ) {
-                       throw new MWException( "Timestamp regex does not match 
exemplar" );
+                       throw new Exception( "Timestamp regex does not match 
exemplar" );
                }
 
                self::$timestampRegex = $output;
diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php
index 854e0d3..fc80e5e 100644
--- a/includes/EmailBatch.php
+++ b/includes/EmailBatch.php
@@ -82,7 +82,7 @@
        /**
         * Get the name of the email batch class
         * @return string
-        * @throws MWException
+        * @throws Exception
         */
        private static function getEmailBatchClass() {
                global $wgEchoBackendName;
@@ -90,7 +90,7 @@
                $className = 'MW' . $wgEchoBackendName . 'EchoEmailBatch';
 
                if ( !class_exists( $className ) ) {
-                       throw new MWException( "$wgEchoBackendName email batch 
is not supported!" );
+                       throw new Exception( "$wgEchoBackendName email batch is 
not supported!" );
                }
 
                return $className;
@@ -234,13 +234,13 @@
         * @param $priority int
         * @param $hash string
         *
-        * @throws MWException
+        * @throws Exception
         */
        public static function addToQueue( $userId, $eventId, $priority, $hash 
) {
                $batchClassName = self::getEmailBatchClass();
 
                if ( !method_exists( $batchClassName, 'actuallyAddToQueue' ) ) {
-                       throw new MWException( "$batchClassName must implement 
method actuallyAddToQueue()" );
+                       throw new Exception( "$batchClassName must implement 
method actuallyAddToQueue()" );
                }
 
                $batchClassName::actuallyAddToQueue( $userId, $eventId, 
$priority, $hash );
@@ -252,14 +252,14 @@
         * @param $startUserId int
         * @param $batchSize int
         *
-        * @throws MWException
+        * @throws Exception
         * @return ResultWrapper|bool
         */
        public static function getUsersToNotify( $startUserId, $batchSize ) {
                $batchClassName = self::getEmailBatchClass();
 
                if ( !method_exists( $batchClassName, 
'actuallyGetUsersToNotify' ) ) {
-                       throw new MWException( "$batchClassName must implement 
method actuallyGetUsersToNotify()" );
+                       throw new Exception( "$batchClassName must implement 
method actuallyGetUsersToNotify()" );
                }
 
                return $batchClassName::actuallyGetUsersToNotify( $startUserId, 
$batchSize );
diff --git a/includes/EmailBundler.php b/includes/EmailBundler.php
index ba01ad1..8d13669 100644
--- a/includes/EmailBundler.php
+++ b/includes/EmailBundler.php
@@ -60,7 +60,7 @@
        /**
         * Get the name of the email batch class
         * @return string
-        * @throws MWException
+        * @throws Exception
         */
        private static function getEmailBundlerClass() {
                global $wgEchoBackendName;
@@ -68,7 +68,7 @@
                $className = 'MW' . $wgEchoBackendName . 'EchoEmailBundler';
 
                if ( !class_exists( $className ) ) {
-                       throw new MWException( "$wgEchoBackendName email 
bundler is not supported!" );
+                       throw new Exception( "$wgEchoBackendName email bundler 
is not supported!" );
                }
 
                return $className;
@@ -216,7 +216,7 @@
                // User has switched to email digest or decided not to receive 
email,
                // the daily cron will handle events left in the queue
                if ( $emailSetting != 0 ) {
-                       throw new MWException( "User has switched to email 
digest/no email option!" );
+                       throw new Exception( "User has switched to email 
digest/no email option!" );
                }
 
                // If there is nothing in the queue, do not update timestamp so 
next
@@ -227,7 +227,7 @@
                        $this->sendEmail();
                        $this->clearProcessedEvent();
                } else {
-                       throw new MWException( "There is no bundle notification 
to process!" );
+                       throw new Exception( "There is no bundle notification 
to process!" );
                }
        }
 
@@ -238,7 +238,7 @@
                $content = $this->generateEmailContent();
 
                if ( !isset( $content['subject'] ) || !isset( $content['body'] 
) ) {
-                       throw new MWException( "Fail to create bundle email 
content!" );
+                       throw new Exception( "Fail to create bundle email 
content!" );
                }
 
                global $wgNotificationSender, $wgNotificationReplyName;
diff --git a/includes/NotifUser.php b/includes/NotifUser.php
index 30ca94d..a74f431 100644
--- a/includes/NotifUser.php
+++ b/includes/NotifUser.php
@@ -69,12 +69,12 @@
        /**
         * Factory method
         * @param $user User
-        * @throws MWException
+        * @throws Exception
         * @return MWEchoNotifUser
         */
        public static function newFromUser( User $user ) {
                if ( $user->isAnon() ) {
-                       throw new MWException( 'User must be logged in to view 
notification!' );
+                       throw new Exception( 'User must be logged in to view 
notification!' );
                }
                global $wgMemc;
                return new MWEchoNotifUser(
diff --git a/includes/exception/CatchableFatalErrorException.php 
b/includes/exception/CatchableFatalErrorException.php
index 500e699..ae6f216 100644
--- a/includes/exception/CatchableFatalErrorException.php
+++ b/includes/exception/CatchableFatalErrorException.php
@@ -1,6 +1,6 @@
 <?php
 
-class EchoCatchableFatalErrorException extends MWException {
+class EchoCatchableFatalErrorException extends Exception {
 
        public function __construct( $errno, $errstr, $errfile, $errline ) {
                parent::__construct( "Catchable fatal error: $errstr", $errno );
diff --git a/includes/iterator/FilteredSequentialIterator.php 
b/includes/iterator/FilteredSequentialIterator.php
index cc0271f..0b592c4 100644
--- a/includes/iterator/FilteredSequentialIterator.php
+++ b/includes/iterator/FilteredSequentialIterator.php
@@ -54,7 +54,7 @@
                } elseif ( $users instanceof IteratorAggregate ) {
                        $it = $users->getIterator();
                } else {
-                       throw new MWException( 'Expected array, Iterator or 
IteratorAggregate but received:' .
+                       throw new Exception( 'Expected array, Iterator or 
IteratorAggregate but received:' .
                                ( is_object( $users ) ? get_class( $users ) : 
gettype( $users ) )
                        );
                }
diff --git a/includes/mapper/AbstractMapper.php 
b/includes/mapper/AbstractMapper.php
index a69aa10..3736bf2 100644
--- a/includes/mapper/AbstractMapper.php
+++ b/includes/mapper/AbstractMapper.php
@@ -36,7 +36,7 @@
         */
        public function attachListener( $method, $key, $callable ) {
                if ( !method_exists( $this, $method ) ) {
-                       throw new MWException( $method . ' does not exist in ' 
. get_class( $this ) );
+                       throw new Exception( $method . ' does not exist in ' . 
get_class( $this ) );
                }
                if ( !isset( $this->listeners[$method] ) ) {
                        $this->listeners[$method] = array();
@@ -64,7 +64,7 @@
         */
        public function getMethodListeners( $method ) {
                if ( !method_exists( $this, $method ) ) {
-                       throw new MWException( $method . ' does not exist in ' 
. get_class( $this ) );
+                       throw new Exception( $method . ' does not exist in ' . 
get_class( $this ) );
                }
                if ( isset( $this->listeners[$method] ) ) {
                        return $this->listeners[$method];
diff --git a/includes/mapper/EventMapper.php b/includes/mapper/EventMapper.php
index b9d3c32..c3eb037 100644
--- a/includes/mapper/EventMapper.php
+++ b/includes/mapper/EventMapper.php
@@ -40,7 +40,7 @@
         * @param int
         * @param boolean
         * @return EchoEvent
-        * @throws MWException
+        * @throws Exception
         */
        public function fetchById( $id, $fromMaster = false ) {
                $db = $fromMaster ? $this->dbFactory->getEchoDb( DB_MASTER ) : 
$this->dbFactory->getEchoDb( DB_SLAVE );
@@ -50,7 +50,7 @@
                if ( !$row && !$fromMaster ) {
                        return $this->fetchById( $id, true );
                } elseif ( !$row ) {
-                       throw new MWException( "No EchoEvent found with ID: 
$id" );
+                       throw new Exception( "No EchoEvent found with ID: $id" 
);
                }
 
                return EchoEvent::newFromRow( $row );
diff --git a/includes/mapper/NotificationMapper.php 
b/includes/mapper/NotificationMapper.php
index 8844c60..dc7b246 100644
--- a/includes/mapper/NotificationMapper.php
+++ b/includes/mapper/NotificationMapper.php
@@ -51,7 +51,7 @@
        /**
         * Extract the offset used for notification list
         * @param $continue String Used for offset
-        * @throws MWException
+        * @throws Exception
         * @return int[]
         */
        protected function extractQueryOffset( $continue ) {
@@ -62,7 +62,7 @@
                if ( $continue ) {
                        $values = explode( '|', $continue, 3 );
                        if ( count( $values ) !== 2 ) {
-                               throw new MWException( 'Invalid continue param: 
' . $continue );
+                               throw new Exception( 'Invalid continue param: ' 
. $continue );
                        }
                        $offset['timestamp'] = (int)$values[0];
                        $offset['offset'] = (int)$values[1];
@@ -184,7 +184,7 @@
                                } catch ( Exception $e ) {
                                        $id = isset( $row->event_id ) ? 
$row->event_id : 'unknown event';
                                        wfDebugLog( 'Echo', __METHOD__ . ": 
Failed initializing event: $id" );
-                                       MWExceptionHandler::logException( $e );
+                                       ExceptionHandler::logException( $e );
                                }
                        }
                }
diff --git a/jobs/NotificationEmailBundleJob.php 
b/jobs/NotificationEmailBundleJob.php
index fbb4ff8..9752ab4 100644
--- a/jobs/NotificationEmailBundleJob.php
+++ b/jobs/NotificationEmailBundleJob.php
@@ -18,7 +18,7 @@
                if ( $bundle ) {
                        $bundle->processBundleEmail();
                } else {
-                       throw new MWException( 'Fail to create bundle object 
for: user_id: ' . $this->params['user_id'] . ', bundle_hash: ' . 
$this->params['bundle_hash'] );
+                       throw new Exception( 'Fail to create bundle object for: 
user_id: ' . $this->params['user_id'] . ', bundle_hash: ' . 
$this->params['bundle_hash'] );
                }
 
                return true;
diff --git a/model/Event.php b/model/Event.php
index 235c026..47b23a7 100644
--- a/model/Event.php
+++ b/model/Event.php
@@ -56,7 +56,7 @@
        ## Save the id and timestamp
        function __sleep() {
                if ( !$this->id ) {
-                       throw new MWException( "Unable to serialize an 
uninitialized EchoEvent" );
+                       throw new Exception( "Unable to serialize an 
uninitialized EchoEvent" );
                }
                return array( 'id', 'timestamp' );
        }
@@ -78,7 +78,7 @@
         * title: The page on which the event was triggered;
         * extra: Event-specific extra information (e.g. post content)
         *
-        * @throws MWException
+        * @throws Exception
         * @return EchoEvent|bool false if aborted via hook
         */
        public static function create( $info = array() ) {
@@ -93,7 +93,7 @@
                static $validFields = array( 'type', 'variant', 'agent', 
'title', 'extra' );
 
                if ( empty( $info['type'] ) ) {
-                       throw new MWException( "'type' parameter is mandatory" 
);
+                       throw new Exception( "'type' parameter is mandatory" );
                }
 
                if ( !isset( $wgEchoNotifications[$info['type']] ) ) {
@@ -120,7 +120,7 @@
 
                if ( $obj->title ) {
                        if ( !$obj->title instanceof Title ) {
-                               throw new MWException( 'Invalid title 
parameter' );
+                               throw new Exception( 'Invalid title parameter' 
);
                        }
                        $obj->setTitle( $obj->title );
                }
@@ -129,7 +129,7 @@
                ( $obj->agent instanceof User ||
                        $obj->agent instanceof StubObject )
                ) {
-                       throw new MWException( "Invalid user parameter" );
+                       throw new Exception( "Invalid user parameter" );
                }
 
                if ( !wfRunHooks( 'BeforeEchoEventInsert', array( $obj ) ) ) {
diff --git a/model/Notification.php b/model/Notification.php
index a0f808b..bb21ca8 100644
--- a/model/Notification.php
+++ b/model/Notification.php
@@ -57,7 +57,7 @@
         * @param $info array The following keys are required:
         * - 'event' The EchoEvent being notified about.
         * - 'user' The User being notified.
-        * @throws MWException
+        * @throws Exception
         * @return EchoNotification
         */
        public static function create( array $info ) {
@@ -68,16 +68,16 @@
                        if ( isset( $info[$field] ) ) {
                                $obj->$field = $info[$field];
                        } else {
-                               throw new MWException( "Field $field is 
required" );
+                               throw new Exception( "Field $field is required" 
);
                        }
                }
 
                if ( !$obj->user instanceof User && !$obj->user instanceof 
StubObject ) {
-                       throw new MWException( 'Invalid user parameter, 
expected: User/StubObject object' );
+                       throw new Exception( 'Invalid user parameter, expected: 
User/StubObject object' );
                }
 
                if ( !$obj->event instanceof EchoEvent ) {
-                       throw new MWException( 'Invalid event parameter, 
expected: EchoEvent object' );
+                       throw new Exception( 'Invalid event parameter, 
expected: EchoEvent object' );
                }
 
                // Notification timestamp should be the same as event timestamp
diff --git a/model/TargetPage.php b/model/TargetPage.php
index cc84660..f1756f5 100644
--- a/model/TargetPage.php
+++ b/model/TargetPage.php
@@ -64,7 +64,7 @@
         *
         * @param stdClass $row
         * @return EchoTargetPage
-        * @throws MWException
+        * @throws Exception
         */
        public static function newFromRow( $row ) {
                $requiredFields = array (
@@ -74,7 +74,7 @@
                );
                foreach ( $requiredFields as $field ) {
                        if ( !isset( $row->$field ) || !$row->$field ) {
-                               throw new MWException( $field . ' is not set in 
the row!' );
+                               throw new Exception( $field . ' is not set in 
the row!' );
                        }
                }
                $obj = new self();
diff --git a/tests/phpunit/includes/DiscussionParserTest.php 
b/tests/phpunit/includes/DiscussionParserTest.php
index 7b0a611..812e143 100644
--- a/tests/phpunit/includes/DiscussionParserTest.php
+++ b/tests/phpunit/includes/DiscussionParserTest.php
@@ -31,13 +31,13 @@
 line 4
 TEXT
                        );
-               } catch ( MWException $e ) {
+               } catch ( Exception $e ) {
                        $wgDiff = $origWgDiff;
                        throw $e;
                }
                $wgDiff = $origWgDiff;
 
-               // Test failure occurs when MWException is thrown due to 
parsing failure
+               // Test failure occurs when Exception is thrown due to parsing 
failure
                $this->assertTrue( true );
        }
 
diff --git a/tests/phpunit/includes/mapper/AbstractMapperTest.php 
b/tests/phpunit/includes/mapper/AbstractMapperTest.php
index cf91a45..15744ca 100644
--- a/tests/phpunit/includes/mapper/AbstractMapperTest.php
+++ b/tests/phpunit/includes/mapper/AbstractMapperTest.php
@@ -18,7 +18,7 @@
        }
 
        /**
-        * @expectedException MWException
+        * @expectedException Exception
         */
        public function testAttachListenerWithException() {
                $mapper = new EchoAbstractMapperStub();
@@ -39,7 +39,7 @@
 
        /**
         * @depends testAttachListener
-        * @expectedException MWException
+        * @expectedException Exception
         */
        public function testGetMethodListenersWithException( $data ) {
                $mapper = $data['mapper'];
diff --git a/tests/phpunit/includes/mapper/EventMapperTest.php 
b/tests/phpunit/includes/mapper/EventMapperTest.php
index 834df68..03b2a88 100644
--- a/tests/phpunit/includes/mapper/EventMapperTest.php
+++ b/tests/phpunit/includes/mapper/EventMapperTest.php
@@ -55,7 +55,7 @@
        }
 
        /**
-        * @expectedException MWException
+        * @expectedException Exception
         */
        public function testUnsuccessfulFetchById() {
                $eventMapper = new EchoEventMapper(
diff --git a/tests/phpunit/model/NotificationTest.php 
b/tests/phpunit/model/NotificationTest.php
index 8bb4cf2..c5a399c 100644
--- a/tests/phpunit/model/NotificationTest.php
+++ b/tests/phpunit/model/NotificationTest.php
@@ -31,7 +31,7 @@
        }
 
        /**
-        * @expectedException MWException
+        * @expectedException Exception
         */
        public function testNewFromRowWithException() {
                $row = $this->mockNotificationRow();
diff --git a/tests/phpunit/model/TargetPageTest.php 
b/tests/phpunit/model/TargetPageTest.php
index 29670ff..c2811a5 100644
--- a/tests/phpunit/model/TargetPageTest.php
+++ b/tests/phpunit/model/TargetPageTest.php
@@ -49,7 +49,7 @@
        }
 
        /**
-        * @expectedException MWException
+        * @expectedException Exception
         */
        public function testNewFromRowWithException() {
                $row = (object) array (

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I353047bf79f578afd8b44fe01b1cae8c960fd9ac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to