Jeroen De Dauw has uploaded a new change for review.

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


Change subject: Put PropertyNotFoundException into its own file and added 
PropertyId field
......................................................................

Put PropertyNotFoundException into its own file and added PropertyId field

Change-Id: Ie6dd4aa884aaf9be6c5ff7a4c721b9ec5d880e1a
---
M lib/WikibaseLib.classes.php
M lib/includes/EntityRetrievingDataTypeLookup.php
A lib/includes/PropertyNotFoundException.php
3 files changed, 52 insertions(+), 9 deletions(-)


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

diff --git a/lib/WikibaseLib.classes.php b/lib/WikibaseLib.classes.php
index 6dd483d..6262c0c 100644
--- a/lib/WikibaseLib.classes.php
+++ b/lib/WikibaseLib.classes.php
@@ -51,6 +51,7 @@
                'Wikibase\ReferencedEntitiesFinder' => 
'includes/ReferencedEntitiesFinder.php',
                'Wikibase\ObjectComparer' => 'includes/ObjectComparer.php',
                'Wikibase\Lib\PropertyDataTypeLookup' => 
'includes/PropertyDataTypeLookup.php',
+               'Wikibase\Lib\PropertyNotFoundException' => 
'includes/PropertyNotFoundException.php',
                'Wikibase\Settings' => 'includes/Settings.php',
                'Wikibase\SettingsArray' => 'includes/SettingsArray.php',
                'Wikibase\Lib\SnakFormatter' => 'includes/SnakFormatter.php',
diff --git a/lib/includes/EntityRetrievingDataTypeLookup.php 
b/lib/includes/EntityRetrievingDataTypeLookup.php
index bff63d3..bab6eaf 100644
--- a/lib/includes/EntityRetrievingDataTypeLookup.php
+++ b/lib/includes/EntityRetrievingDataTypeLookup.php
@@ -2,7 +2,6 @@
 
 namespace Wikibase\Lib;
 
-use DataTypes\DataType;
 use InvalidArgumentException;
 use Wikibase\EntityId;
 use Wikibase\EntityLookup;
@@ -67,13 +66,13 @@
         * @param EntityId $propertyId
         *
         * @return Property
-        * @throws PropertyNotFoundExtension
+        * @throws PropertyNotFoundException
         */
        private function getProperty( EntityId $propertyId ) {
                $property = $this->entityLookup->getEntity( $propertyId );
 
                if ( $property === null ) {
-                       throw new PropertyNotFoundExtension();
+                       throw new PropertyNotFoundException( $propertyId );
                }
 
                assert( $property instanceof Property );
@@ -81,9 +80,3 @@
        }
 
 }
-
-class PropertyNotFoundExtension extends \RuntimeException {
-
-
-
-}
\ No newline at end of file
diff --git a/lib/includes/PropertyNotFoundException.php 
b/lib/includes/PropertyNotFoundException.php
new file mode 100644
index 0000000..2386f57
--- /dev/null
+++ b/lib/includes/PropertyNotFoundException.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Wikibase\Lib;
+
+use Wikibase\EntityId;
+use Wikibase\Property;
+
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @since 0.4
+ *
+ * @file
+ * @ingroup WikibaseLib
+ *
+ * @licence GNU GPL v2+
+ * @author Jeroen De Dauw < [email protected] >
+ */
+class PropertyNotFoundException extends \RuntimeException {
+
+       protected $propertyId;
+
+       public function __construct( EntityId $propertyId, $message = '', 
\Exception $previous = null ) {
+               $this->propertyId = $propertyId;
+
+               parent::__construct( $message, 0, $previous );
+       }
+
+       /**
+        * @return EntityId
+        */
+       public function getPropertyId() {
+               return $this->propertyId;
+       }
+
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6dd4aa884aaf9be6c5ff7a4c721b9ec5d880e1a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

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

Reply via email to