Hoo man has uploaded a new change for review.

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


Change subject: Throw an exception in 
PropertyInfoTableBuilder::updatePropertyInfo
......................................................................

Throw an exception in PropertyInfoTableBuilder::updatePropertyInfo

in case the EntityLookup didn't return a Property. This is more
sane as the following code will die horribly anyway if a non
Property is given.

Change-Id: Ie836aa43ca2b5dbb872c5c85e5d00991d40f35d2
---
M repo/includes/store/sql/PropertyInfoTableBuilder.php
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/71/103571/1

diff --git a/repo/includes/store/sql/PropertyInfoTableBuilder.php 
b/repo/includes/store/sql/PropertyInfoTableBuilder.php
index 17b9e92..e2428f0 100644
--- a/repo/includes/store/sql/PropertyInfoTableBuilder.php
+++ b/repo/includes/store/sql/PropertyInfoTableBuilder.php
@@ -5,6 +5,7 @@
 use DatabaseBase;
 use MessageReporter;
 use Wikibase\DataModel\Entity\PropertyId;
+use MWException;
 
 /**
  * Utility class for rebuilding the wb_property_info table.
@@ -257,6 +258,7 @@
         * provide to the constructor.
         *
         * @see Wikibase\PropertyInfoUpdate
+        * @throws MWException
         *
         * @since 0.4
         *
@@ -266,7 +268,11 @@
        protected function updatePropertyInfo( DatabaseBase $dbw, PropertyId 
$id ) {
                $property = $this->entityLookup->getEntity( $id );
 
-               assert( $property instanceof Property );
+               if( !$property instanceof Property ) {
+                       throw new MWException(
+                               "EntityLookup didn't return a Property for id " 
. $id->getPrefixedId()
+                       );
+               }
 
                $update = new PropertyInfoUpdate( $property, $this->table );
                $update->doUpdate();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie836aa43ca2b5dbb872c5c85e5d00991d40f35d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>

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

Reply via email to