Matthias Mullie has uploaded a new change for review.

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

Change subject: MWException -> FlowException
......................................................................

MWException -> FlowException

Flow was already (mostly) using a subclassed FlowException.
I've replaced any leftover occurences of MWException by FlowException.

FlowException still subclasses MWException instead of Exception.
It does so because of MWException::report, which "Try and show the
exception prettily, with the normal skin infrastructure"

Change-Id: I8823d714dd02ff99e976d37f8c558a2eb8686f62
---
M includes/Actions/PurgeAction.php
M includes/Block/Topic.php
M includes/Block/TopicList.php
M includes/Content/BoardContent.php
M includes/Content/BoardContentHandler.php
M includes/Data/Index/TopicHistoryIndex.php
M includes/Data/Storage/BasicDbStorage.php
M includes/Data/Storage/RevisionStorage.php
M includes/Data/Storage/TopicListLastUpdatedStorage.php
M includes/Formatter/AbstractQuery.php
M includes/Formatter/ContributionsQuery.php
M includes/Import/LiquidThreadsApi/Source.php
M includes/Parsoid/Fixer/BadImageRemover.php
M includes/Parsoid/ReferenceExtractor.php
M includes/TalkpageManager.php
M maintenance/FlowPopulateLinksTables.php
M maintenance/FlowUpdateRevisionTypeId.php
M maintenance/FlowUpdateUserWiki.php
M maintenance/convertToText.php
M tests/phpunit/PostRevisionTestCase.php
20 files changed, 66 insertions(+), 55 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/04/188604/1

diff --git a/includes/Actions/PurgeAction.php b/includes/Actions/PurgeAction.php
index cac8ba5..6793bbb 100644
--- a/includes/Actions/PurgeAction.php
+++ b/includes/Actions/PurgeAction.php
@@ -6,6 +6,7 @@
 use Flow\Container;
 use Flow\Data\ManagerGroup;
 use Flow\Data\Pager\Pager;
+use Flow\Exception\FlowException;
 use Flow\Formatter\TopicListQuery;
 use Flow\Model\TopicListEntry;
 use Flow\Model\UUID;
@@ -62,7 +63,7 @@
                        break;
 
                default:
-                       throw new \MWException( 'Unknown workflow type: ' . 
$workflow->getType() );
+                       throw new FlowException( 'Unknown workflow type: ' . 
$workflow->getType() );
                }
 
                // delete all the keys we just visited
diff --git a/includes/Block/Topic.php b/includes/Block/Topic.php
index 0462ed6..fc5ddc7 100644
--- a/includes/Block/Topic.php
+++ b/includes/Block/Topic.php
@@ -442,7 +442,7 @@
                        // @todo make more explicit
                        try {
                                $newRevision->getChildren();
-                       } catch ( \MWException $e ) {
+                       } catch ( \Exception $e ) {
                                $newRevision->setChildren( array() );
                        }
 
diff --git a/includes/Block/TopicList.php b/includes/Block/TopicList.php
index a532d13..a879706 100644
--- a/includes/Block/TopicList.php
+++ b/includes/Block/TopicList.php
@@ -104,8 +104,7 @@
         * * $this->topicTitle
         * * $this->firstPost
         *
-        * @throws \MWException
-        * @throws \Flow\Exception\FailCommitException
+        * @throws \Flow\Exception\DataModelException
         * @return array Array of [$topicWorkflow, $topicListEntry, 
$topicTitle, $firstPost]
         */
        protected function create() {
diff --git a/includes/Content/BoardContent.php 
b/includes/Content/BoardContent.php
index 0e9815f..f4af2d5 100644
--- a/includes/Content/BoardContent.php
+++ b/includes/Content/BoardContent.php
@@ -5,12 +5,12 @@
 use DerivativeContext;
 use FauxRequest;
 use Flow\Container;
+use Flow\Exception\FlowException;
 use Flow\LinksTableUpdater;
 use Flow\Model\UUID;
 use Flow\Model\Workflow;
 use Flow\View;
 use Flow\WorkflowLoaderFactory;
-use MWException;
 use OutputPage;
 use ParserOptions;
 use ParserOutput;
@@ -30,7 +30,7 @@
                        $workflow instanceof UUID ||
                        $workflow instanceof Workflow
                ) ) {
-                       throw new MWException( "Invalid argument for 'workflow' 
parameter." );
+                       throw new FlowException( "Invalid argument for 
'workflow' parameter." );
                }
 
                if (
@@ -219,7 +219,7 @@
                } elseif ( $this->workflow === null ) {
                        return null;
                } else {
-                       throw new MWException( "Unknown Workflow specifier" );
+                       throw new FlowException( "Unknown Workflow specifier" );
                }
        }
 }
diff --git a/includes/Content/BoardContentHandler.php 
b/includes/Content/BoardContentHandler.php
index a6ec946..4da56db 100644
--- a/includes/Content/BoardContentHandler.php
+++ b/includes/Content/BoardContentHandler.php
@@ -3,15 +3,15 @@
 namespace Flow\Content;
 
 use Flow\Container;
+use Flow\Exception\FlowException;
 use Flow\FlowActions;
 use Flow\Model\UUID;
 use FormatJson;
-use MWException;
 
 class BoardContentHandler extends \ContentHandler {
        public function __construct( $modelId ) {
                if ( $modelId !== CONTENT_MODEL_FLOW_BOARD ) {
-                       throw new MWException( __CLASS__." initialised for 
invalid content model" );
+                       throw new FlowException( __CLASS__ . " initialised for 
invalid content model" );
                }
 
                parent::__construct( CONTENT_MODEL_FLOW_BOARD, array( 
CONTENT_FORMAT_JSON ) );
@@ -35,11 +35,11 @@
         * @param \Content $content The Content object to serialize
         * @param string|null $format The desired serialization format
         * @return string Serialized form of the content
-        * @throws MWException
+        * @throws FlowException
         */
        public function serializeContent( \Content $content, $format = null ) {
                if ( ! $content instanceof BoardContent ) {
-                       throw new MWException( "Expected a BoardContent object, 
got a " . get_class( $content ) );
+                       throw new FlowException( "Expected a BoardContent 
object, got a " . get_class( $content ) );
                }
 
                $info = array();
diff --git a/includes/Data/Index/TopicHistoryIndex.php 
b/includes/Data/Index/TopicHistoryIndex.php
index 01b1659..4fc676a 100644
--- a/includes/Data/Index/TopicHistoryIndex.php
+++ b/includes/Data/Index/TopicHistoryIndex.php
@@ -4,13 +4,13 @@
 
 use Flow\Data\BufferedCache;
 use Flow\Data\Storage\TopicHistoryStorage;
+use Flow\Exception\FlowException;
 use Flow\Exception\InvalidInputException;
 use Flow\Model\PostRevision;
 use Flow\Model\PostSummary;
 use Flow\Model\Workflow;
 use Flow\Model\UUID;
 use Flow\Repository\TreeRepository;
-use MWException;
 
 /**
  * Slight tweak to the TopKIndex uses additional info from TreeRepository to 
build the cache
@@ -21,7 +21,7 @@
 
        public function __construct( BufferedCache $cache, TopicHistoryStorage 
$storage, TreeRepository $treeRepo, $prefix, array $indexed, array $options = 
array() ) {
                if ( $indexed !== array( 'topic_root_id' ) ) {
-                       throw new \MWException( __CLASS__ . ' is hardcoded to 
only index topic_root_id: ' . print_r( $indexed, true ) );
+                       throw new FlowException( __CLASS__ . ' is hardcoded to 
only index topic_root_id: ' . print_r( $indexed, true ) );
                }
                parent::__construct( $cache, $storage, $prefix, $indexed, 
$options );
                $this->treeRepository = $treeRepo;
diff --git a/includes/Data/Storage/BasicDbStorage.php 
b/includes/Data/Storage/BasicDbStorage.php
index 380fb8a..0daac2c 100644
--- a/includes/Data/Storage/BasicDbStorage.php
+++ b/includes/Data/Storage/BasicDbStorage.php
@@ -2,6 +2,7 @@
 
 namespace Flow\Data\Storage;
 
+use Flow\Exception\FlowException;
 use Flow\Model\UUID;
 use Flow\DbFactory;
 use Flow\Data\ObjectManager;
@@ -132,7 +133,7 @@
                $attributes = $this->preprocessSqlArray( $attributes );
 
                if ( ! $this->validateOptions( $options ) ) {
-                       throw new \MWException( "Validation error in database 
options" );
+                       throw new FlowException( "Validation error in database 
options" );
                }
 
                $res = $this->dbFactory->getDB( DB_MASTER )->select(
diff --git a/includes/Data/Storage/RevisionStorage.php 
b/includes/Data/Storage/RevisionStorage.php
index 97a5c13..dbb3420 100644
--- a/includes/Data/Storage/RevisionStorage.php
+++ b/includes/Data/Storage/RevisionStorage.php
@@ -9,8 +9,8 @@
 use Flow\Data\ObjectManager;
 use Flow\DbFactory;
 use Flow\Exception\DataModelException;
+use Flow\Exception\FlowException;
 use Flow\Model\UUID;
-use MWException;
 
 /**
  * Abstract storage implementation for models extending from AbstractRevision
@@ -124,7 +124,7 @@
                $dbr = $this->dbFactory->getDB( DB_MASTER );
 
                if ( ! $this->validateOptions( $options ) ) {
-                       throw new MWException( "Validation error in database 
options" );
+                       throw new FlowException( "Validation error in database 
options" );
                }
 
                // Add rev_type if rev_type_id exists in query condition
diff --git a/includes/Data/Storage/TopicListLastUpdatedStorage.php 
b/includes/Data/Storage/TopicListLastUpdatedStorage.php
index 51e4b03..a192171 100644
--- a/includes/Data/Storage/TopicListLastUpdatedStorage.php
+++ b/includes/Data/Storage/TopicListLastUpdatedStorage.php
@@ -2,6 +2,7 @@
 
 namespace Flow\Data\Storage;
 
+use Flow\Exception\FlowException;
 use Flow\Model\UUID;
 
 /**
@@ -18,7 +19,7 @@
                $attributes = $this->preprocessSqlArray( $attributes );
 
                if ( !$this->validateOptions( $options ) ) {
-                       throw new \MWException( "Validation error in database 
options" );
+                       throw new FlowException( "Validation error in database 
options" );
                }
 
                $res = $this->dbFactory->getDB( DB_MASTER )->select(
diff --git a/includes/Formatter/AbstractQuery.php 
b/includes/Formatter/AbstractQuery.php
index ee01887..d1ada58 100644
--- a/includes/Formatter/AbstractQuery.php
+++ b/includes/Formatter/AbstractQuery.php
@@ -221,7 +221,7 @@
        /**
         * @param AbstractRevision $revision
         * @return Workflow
-        * @throws \MWException
+        * @throws FlowException
         */
        protected function getWorkflow( AbstractRevision $revision ) {
                if ( $revision instanceof PostRevision ) {
@@ -232,7 +232,7 @@
                } elseif ( $revision instanceof PostSummary ) {
                        return $this->getWorkflowById( 
$revision->getCollection()->getWorkflowId() );
                } else {
-                       throw new \MWException( 'Unsupported revision type ' . 
get_class( $revision ) );
+                       throw new FlowException( 'Unsupported revision type ' . 
get_class( $revision ) );
                }
        }
 
@@ -291,7 +291,7 @@
         * Retrieves the root post for a given PostRevision
         * @param  PostRevision $revision The revision to retrieve the root 
post for.
         * @return PostRevision           PostRevision of the root post.
-        * @throws \MWException
+        * @throws FlowException
         */
        protected function getRootPost( PostRevision $revision ) {
                if ( $revision->isTopicTitle() ) {
@@ -300,15 +300,15 @@
                $rootPostId = $this->getRootPostId( $revision );
 
                if ( !isset( $this->postCache[$rootPostId->getAlphadecimal()] ) 
) {
-                       throw new \MwException( 'Did not load root post ' . 
$rootPostId->getAlphadecimal() );
+                       throw new FlowException( 'Did not load root post ' . 
$rootPostId->getAlphadecimal() );
                }
 
                $rootPost = $this->postCache[$rootPostId->getAlphadecimal()];
                if ( !$rootPost ) {
-                       throw new \MWException( 'Did not locate root post ' . 
$rootPostId->getAlphadecimal() );
+                       throw new FlowException( 'Did not locate root post ' . 
$rootPostId->getAlphadecimal() );
                }
                if ( !$rootPost->isTopicTitle() ) {
-                       throw new \MWException( "Not a topic title: " . 
$rootPost->getRevisionId() );
+                       throw new FlowException( "Not a topic title: " . 
$rootPost->getRevisionId() );
                }
 
                return $rootPost;
@@ -318,7 +318,7 @@
         * Gets the root post ID for a given PostRevision
         * @param  PostRevision $revision The revision to get the root post ID 
for.
         * @return UUID                   The UUID for the root post.
-        * @throws \MWException
+        * @throws FlowException
         */
        protected function getRootPostId( PostRevision $revision ) {
                $postId = $revision->getPostId();
@@ -327,7 +327,7 @@
                } elseif ( isset( 
$this->rootPostIdCache[$postId->getAlphadecimal()] ) ) {
                        return 
$this->rootPostIdCache[$postId->getAlphadecimal()];
                } else {
-                       throw new \MWException( "Unable to find root post ID 
for post " . $postId->getAlphadecimal() );
+                       throw new FlowException( "Unable to find root post ID 
for post " . $postId->getAlphadecimal() );
                }
        }
 
@@ -367,11 +367,11 @@
 
        // protect against typos
        public function __get( $attribute ) {
-               throw new \MWException( "Accessing non-existent parameter: 
$attribute" );
+               throw new FlowException( "Accessing non-existent parameter: 
$attribute" );
        }
 
        // protect against typos
        public function __set( $attribute, $value ) {
-               throw new \MWException( "Accessing non-existent parameter: 
$attribute" );
+               throw new FlowException( "Accessing non-existent parameter: 
$attribute" );
        }
 }
diff --git a/includes/Formatter/ContributionsQuery.php 
b/includes/Formatter/ContributionsQuery.php
index c3d9c70..a4059e0 100644
--- a/includes/Formatter/ContributionsQuery.php
+++ b/includes/Formatter/ContributionsQuery.php
@@ -138,7 +138,7 @@
         * @param int $limit
         * @param string $revisionClass Storage type (e.g. "PostRevision", 
"Header")
         * @return ResultWrapper|false false on failure
-        * @throws \MWException
+        * @throws FlowException
         */
        protected function queryRevisions( $conditions, $limit, $revisionClass 
) {
                $dbr = $this->dbFactory->getDB( DB_SLAVE );
@@ -217,7 +217,7 @@
                                break;
 
                        default:
-                               throw new \MWException( 'Unsupported revision 
type ' . $revisionClass );
+                               throw new FlowException( 'Unsupported revision 
type ' . $revisionClass );
                                break;
                }
        }
diff --git a/includes/Import/LiquidThreadsApi/Source.php 
b/includes/Import/LiquidThreadsApi/Source.php
index bd46b7e..b1d6853 100644
--- a/includes/Import/LiquidThreadsApi/Source.php
+++ b/includes/Import/LiquidThreadsApi/Source.php
@@ -7,6 +7,7 @@
 use Exception;
 use FauxRequest;
 use Flow\Container;
+use Flow\Exception\FlowException;
 use Flow\Import\ImportException;
 use Flow\Import\IImportSource;
 use Http;
@@ -177,11 +178,13 @@
         *
         * @param  array  $pageIds Page IDs to return data for.
         * @return array The query.pages part of the API response.
-        * @throws \MWException
+        * @throws ApiNotFoundException
+        * @throws FlowException
+        * @throws ImportException
         */
        public function retrievePageDataById( array $pageIds ) {
                if ( !$pageIds ) {
-                       throw new \MWException( 'At least one page id must be 
provided' );
+                       throw new FlowException( 'At least one page id must be 
provided' );
                }
 
                return $this->retrievePageData( array(
@@ -195,12 +198,13 @@
         *
         * @param string[] $titles Titles to return data for
         * @return array The query.pages prt of the API response.
-        * @throws \MWException
+        * @throws ApiNotFoundException
+        * @throws FlowException
         * @throws ImportException
         */
        public function retrieveTopRevisionByTitle( array $titles ) {
                if ( !$titles ) {
-                       throw new \MWException( 'At least one title must be 
provided' );
+                       throw new FlowException( 'At least one title must be 
provided' );
                }
 
                return $this->retrievePageData( array(
diff --git a/includes/Parsoid/Fixer/BadImageRemover.php 
b/includes/Parsoid/Fixer/BadImageRemover.php
index e590858..6504045 100644
--- a/includes/Parsoid/Fixer/BadImageRemover.php
+++ b/includes/Parsoid/Fixer/BadImageRemover.php
@@ -4,6 +4,7 @@
 
 use DOMElement;
 use DOMNode;
+use Flow\Exception\FlowException;
 use Flow\Model\PostRevision;
 use Flow\Parsoid\Fixer;
 use Flow\Parsoid\Utils;
@@ -51,7 +52,7 @@
         *
         * @param DOMNode $node
         * @param Title $title
-        * @throws \MWException
+        * @throws FlowException
         */
        public function apply( DOMNode $node, Title $title ) {
                if ( !$node instanceof DOMElement ) {
@@ -79,7 +80,7 @@
                        $nodeToRemove = $nodeToRemove->parentNode;
                }
                if ( !$nodeToRemove ) {
-                       throw new \MWException( 'Did not find parent mw:Image 
to remove' );
+                       throw new FlowException( 'Did not find parent mw:Image 
to remove' );
                }
                $nodeToRemove->parentNode->removeChild( $nodeToRemove );
        }
diff --git a/includes/Parsoid/ReferenceExtractor.php 
b/includes/Parsoid/ReferenceExtractor.php
index c9a361a..1aac648 100644
--- a/includes/Parsoid/ReferenceExtractor.php
+++ b/includes/Parsoid/ReferenceExtractor.php
@@ -3,10 +3,10 @@
 namespace Flow\Parsoid;
 
 use DOMXPath;
+use Flow\Exception\FlowException;
 use Flow\Model\Reference;
 use Flow\Model\UUID;
 use Flow\Model\Workflow;
-use MWException;
 
 /**
  * Extracts references to templates, files and pages (in the form of links)
@@ -43,7 +43,7 @@
         * @param ReferenceFactory $factory
         * @param string $text
         * @return Reference[]
-        * @throws MWException
+        * @throws FlowException
         * @throws \Flow\Exception\WikitextException
         */
        protected function extractReferences( ReferenceFactory $factory, $text 
) {
@@ -58,7 +58,7 @@
 
                        if ( !$elements ) {
                                $class = get_class( $extractor );
-                               throw new MWException( "Malformed xpath from 
$class: " . $extractor->getXPath() );
+                               throw new FlowException( "Malformed xpath from 
$class: " . $extractor->getXPath() );
                        }
 
                        foreach( $elements as $element ) {
diff --git a/includes/TalkpageManager.php b/includes/TalkpageManager.php
index b3c4a04..d20d879 100644
--- a/includes/TalkpageManager.php
+++ b/includes/TalkpageManager.php
@@ -38,7 +38,7 @@
         * Gives a user object used to manage talk pages
         *
         * @return User User to manage talkpages
-        * @throws MWException If a user cannot be created.
+        * @throws FlowException If a user cannot be created.
         */
        public function getTalkpageManager();
 }
@@ -196,7 +196,7 @@
         * Gives a user object used to manage talk pages
         *
         * @return User User to manage talkpages
-        * @throws MWException If both of the names already exist, but are not 
properly
+        * @throws FlowException If both of the names already exist, but are 
not properly
         *  configured.
         */
        public function getTalkpageManager() {
diff --git a/maintenance/FlowPopulateLinksTables.php 
b/maintenance/FlowPopulateLinksTables.php
index 5e1220e..8953cb2 100644
--- a/maintenance/FlowPopulateLinksTables.php
+++ b/maintenance/FlowPopulateLinksTables.php
@@ -1,6 +1,7 @@
 <?php
 
 use Flow\Container;
+use Flow\Exception\FlowException;
 use Flow\Model\UUID;
 
 require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
@@ -49,7 +50,7 @@
                                array( 'ORDER BY' => 'rev_type_id ASC', 'LIMIT' 
=> $this->mBatchSize )
                        );
                        if ( !$res ) {
-                               throw new \MWException( 'SQL error in 
maintenance script ' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __METHOD__ );
                        }
                        foreach ( $res as $row ) {
                                $count++;
@@ -89,7 +90,7 @@
                                array( 'ORDER BY' => 'tree_rev_id ASC', 'LIMIT' 
=> $this->mBatchSize )
                        );
                        if ( !$res ) {
-                               throw new \MWException( 'SQL error in 
maintenance script ' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __METHOD__ );
                        }
                        foreach ( $res as $row ) {
                                $count++;
diff --git a/maintenance/FlowUpdateRevisionTypeId.php 
b/maintenance/FlowUpdateRevisionTypeId.php
index e0637a2..a799cdf 100644
--- a/maintenance/FlowUpdateRevisionTypeId.php
+++ b/maintenance/FlowUpdateRevisionTypeId.php
@@ -1,6 +1,7 @@
 <?php
 
 use Flow\Container;
+use Flow\Exception\FlowException;
 
 $IP = getenv( 'MW_INSTALL_PATH' );
 if ( $IP === false ) {
@@ -63,7 +64,7 @@
                                        }
                                }
                        } else {
-                               throw new MWException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
                        }
                        $dbFactory->waitForSlaves();
                }
@@ -87,7 +88,7 @@
                        __METHOD__
                );
                if ( !$res ) {
-                       throw new MWException( 'SQL error in maintenance script 
' . __CLASS__ . '::' . __METHOD__ );
+                       throw new FlowException( 'SQL error in maintenance 
script ' . __CLASS__ . '::' . __METHOD__ );
                }
        }
 
diff --git a/maintenance/FlowUpdateUserWiki.php 
b/maintenance/FlowUpdateUserWiki.php
index 1f20889..20a854c 100644
--- a/maintenance/FlowUpdateUserWiki.php
+++ b/maintenance/FlowUpdateUserWiki.php
@@ -1,6 +1,7 @@
 <?php
 
 use Flow\Container;
+use Flow\Exception\FlowException;
 use Flow\Model\UUID;
 use Flow\Model\PostRevision;
 
@@ -78,7 +79,7 @@
                                        }
                                }
                        } else {
-                               throw new \MWException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
                        }
                }
 
@@ -116,7 +117,7 @@
                                        }
                                }
                        } else {
-                               throw new \MWException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
                        }
 
                }
@@ -154,7 +155,7 @@
                                        }
                                }
                        } else {
-                               throw new \MWException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
                        }
                }
        }
@@ -206,7 +207,7 @@
                        __METHOD__
                );
                if ( !$res ) {
-                       throw new \MWException( 'SQL error in maintenance 
script ' . __CLASS__ . '::' . __METHOD__ );
+                       throw new FlowException( 'SQL error in maintenance 
script ' . __CLASS__ . '::' . __METHOD__ );
                }
                $this->checkForSlave();
 
@@ -222,7 +223,7 @@
                                __METHOD__
                        );
                        if ( !$res ) {
-                               throw new \MWException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
+                               throw new FlowException( 'SQL error in 
maintenance script ' . __CLASS__ . '::' . __METHOD__ );
                        }
                        $this->checkForSlave();
                }
diff --git a/maintenance/convertToText.php b/maintenance/convertToText.php
index d4f1c7a..0bd786d 100644
--- a/maintenance/convertToText.php
+++ b/maintenance/convertToText.php
@@ -1,5 +1,6 @@
 <?php
 
+use Flow\Exception\FlowException;
 use Flow\Parsoid\Utils;
 
 require_once ( getenv( 'MW_INSTALL_PATH' ) !== false
@@ -78,7 +79,7 @@
         * @param array $request
         * @param bool $requiredBlock
         * @return array
-        * @throws MWException
+        * @throws FlowException
         */
        public function flowApi( Title $title, $submodule, array $request, 
$requiredBlock = false ) {
                $request = new FauxRequest( $request + array(
@@ -93,19 +94,19 @@
                if ( defined( 'ApiResult::META_CONTENT' ) ) {
                        $flowData = $api->getResult()->getResultData( array( 
'flow', $submodule, 'result' ) );
                        if ( $flowData === null ) {
-                               throw new MWException( "API response has no 
Flow data" );
+                               throw new FlowException( "API response has no 
Flow data" );
                        }
                        $flowData = ApiResult::removeMetadata( $flowData );
                } else {
                        $apiResponse = $api->getResult()->getData();
                        if ( ! isset( $apiResponse['flow'] ) ) {
-                               throw new MWException( "API response has no 
Flow data" );
+                               throw new FlowException( "API response has no 
Flow data" );
                        }
                        $flowData = $apiResponse['flow'][$submodule]['result'];
                }
 
                if( $requiredBlock !== false && ! isset( 
$flowData[$requiredBlock] ) ) {
-                       throw new MWException( "No $requiredBlock block in API 
response" );
+                       throw new FlowException( "No $requiredBlock block in 
API response" );
                }
 
                return $flowData;
diff --git a/tests/phpunit/PostRevisionTestCase.php 
b/tests/phpunit/PostRevisionTestCase.php
index 03edf01..d63eaaf 100644
--- a/tests/phpunit/PostRevisionTestCase.php
+++ b/tests/phpunit/PostRevisionTestCase.php
@@ -55,7 +55,7 @@
                foreach ( $this->revisions as $revision ) {
                        try {
                                $this->getStorage()->remove( $revision );
-                       } catch ( \MWException $e ) {
+                       } catch ( \Exception $e ) {
                                // ignore - lifecyclehandlers may cause issues 
with tests, where
                                // not all related stuff is loaded
                        }
@@ -200,7 +200,7 @@
                                // doing updates 1 by 1 so an exception doesn't 
break others in
                                // the queue
                                DeferredUpdates::doUpdates();
-                       } catch ( \MWException $e ) {
+                       } catch ( \Exception $e ) {
                                // ignoring exceptions for now, not all are 
phpunit-proof yet
                        }
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8823d714dd02ff99e976d37f8c558a2eb8686f62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

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

Reply via email to