jenkins-bot has submitted this change and it was merged.

Change subject: Got rid of MWException in Entity
......................................................................


Got rid of MWException in Entity

Change-Id: I4d105d11cd20e152da67ac808b3cd2d1e25732db
---
M DataModel/DataModel/Entity/Entity.php
1 file changed, 11 insertions(+), 10 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/DataModel/DataModel/Entity/Entity.php 
b/DataModel/DataModel/Entity/Entity.php
index 5e89d1f..23b4fb3 100644
--- a/DataModel/DataModel/Entity/Entity.php
+++ b/DataModel/DataModel/Entity/Entity.php
@@ -6,7 +6,8 @@
 use Diff\Differ;
 use Diff\MapPatcher;
 use Diff\Patcher;
-use MWException;
+use InvalidArgumentException;
+use RuntimeException;
 use Wikibase\Lib\GuidGenerator;
 
 /**
@@ -122,7 +123,7 @@
         * @param string $value
         *
         * @return Entity
-        * @throws MWException
+        * @throws RuntimeException
         */
        public function unserialize( $value ) {
                $unserialized = \FormatJson::decode( $value, true );
@@ -133,7 +134,7 @@
                        return $this->__construct( $unserialized );
                }
 
-               throw new MWException( 'Invalid serialization passed to Entity 
unserializer' );
+               throw new RuntimeException( 'Invalid serialization passed to 
Entity unserializer' );
        }
 
        /**
@@ -195,12 +196,12 @@
         *
         * @param EntityId|integer $id Can be EntityId since 0.3
         *
-        * @throws MWException
+        * @throws InvalidArgumentException
         */
        public function setId( $id ) {
                if ( $id instanceof EntityId ) {
                        if ( $id->getEntityType() !== $this->getType() ) {
-                               throw new MWException( 'Attempt to set an 
EntityId with mismatching entity type' );
+                               throw new InvalidArgumentException( 'Attempt to 
set an EntityId with mismatching entity type' );
                        }
 
                        $this->id = $id;
@@ -209,7 +210,7 @@
                        $this->id = new EntityId( $this->getType(), $id );
                }
                else {
-                       throw new MWException( __METHOD__ . ' only accepts 
EntityId and integer' );
+                       throw new InvalidArgumentException( __METHOD__ . ' only 
accepts EntityId and integer' );
                }
        }
 
@@ -809,11 +810,11 @@
         * @param Differ|null $differ Since 0.4
         *
         * @return EntityDiff
-        * @throws MWException
+        * @throws InvalidArgumentException
         */
        public final function getDiff( Entity $target, Differ $differ = null ) {
                if ( $this->getType() !== $target->getType() ) {
-                       throw new MWException( 'Can only diff between entities 
of the same type' );
+                       throw new InvalidArgumentException( 'Can only diff 
between entities of the same type' );
                }
 
                if ( $differ === null ) {
@@ -905,13 +906,13 @@
         * @param string $claimKey
         *
         * @return string
-        * @throws MWException
+        * @throws InvalidArgumentException
         */
        public static function getIdFromClaimGuid( $claimKey ) {
                $keyParts = explode( '$', $claimKey );
 
                if ( count( $keyParts ) !== 2 ) {
-                       throw new MWException( 'A claim key should have a 
single $ in it' );
+                       throw new InvalidArgumentException( 'A claim key should 
have a single $ in it' );
                }
 
                return $keyParts[0];

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4d105d11cd20e152da67ac808b3cd2d1e25732db
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to