Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64273
Change subject: Catch property not found exception in snak formatter
......................................................................
Catch property not found exception in snak formatter
the exception occurs, for example, when referencing a deleted property
with the parser function in the client.
Change-Id: Ib1ddec400cce0e117c952e119899486046c9b548
---
M lib/includes/SnakFormatter.php
1 file changed, 11 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/73/64273/3
diff --git a/lib/includes/SnakFormatter.php b/lib/includes/SnakFormatter.php
index ba47249..1c29ab6 100644
--- a/lib/includes/SnakFormatter.php
+++ b/lib/includes/SnakFormatter.php
@@ -90,10 +90,18 @@
}
private function formatPropertyValueSnak( PropertyValueSnak $snak,
$languageCode ) {
- $dataValue = $snak->getDataValue();
- $dataTypeId = $this->getDataTypeForProperty(
$snak->getPropertyId() );
+ try {
+ $dataValue = $snak->getDataValue();
+ $dataTypeId = $this->getDataTypeForProperty(
$snak->getPropertyId() );
- return $this->typedValueFormatter->formatToString( $dataValue,
$dataTypeId, $languageCode );
+ return $this->typedValueFormatter->formatToString(
$dataValue, $dataTypeId, $languageCode );
+ } catch ( PropertyNotFoundException $e ) {
+ // @todo nicer error handling!
+ wfDebugLog( __CLASS__, __METHOD__ . ': Property '
+ . $snak->getPropertyId()->getPrefixedId() . '
not found.' );
+ }
+
+ return '';
}
private function getDataTypeForProperty( EntityId $propertyId ) {
--
To view, visit https://gerrit.wikimedia.org/r/64273
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1ddec400cce0e117c952e119899486046c9b548
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits