Aude has uploaded a new change for review.
https://gerrit.wikimedia.org/r/67900
Change subject: Handle error in property parser function
......................................................................
Handle error in property parser function
- e.g. unknown globecoordinate
Change-Id: I09c92f297c0f075fe50bc61128b3a9bdc737c072
---
M client/includes/parserhooks/PropertyParserFunction.php
1 file changed, 21 insertions(+), 15 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/00/67900/1
diff --git a/client/includes/parserhooks/PropertyParserFunction.php
b/client/includes/parserhooks/PropertyParserFunction.php
index bd1a9e4..9a6006d 100644
--- a/client/includes/parserhooks/PropertyParserFunction.php
+++ b/client/includes/parserhooks/PropertyParserFunction.php
@@ -128,25 +128,31 @@
public function renderForEntityId( EntityId $entityId, $propertyLabel )
{
wfProfileIn( __METHOD__ );
- $entity = $this->entityLookup->getEntity( $entityId );
+ try {
+ $entity = $this->entityLookup->getEntity( $entityId );
- if ( !$entity ) {
+ if ( !$entity ) {
+ wfProfileOut( __METHOD__ );
+ return '';
+ }
+
+ $claims = $this->getClaimsForProperty( $entity,
$propertyLabel );
+
+ if ( $claims->isEmpty() ) {
+ wfProfileOut( __METHOD__ );
+ return '';
+ }
+
+ $snakList = $claims->getMainSnaks();
+ $text = $this->formatSnakList( $snakList,
$propertyLabel );
+
+
wfProfileOut( __METHOD__ );
+ return $text;
+ } catch ( \Exception $e ) {
+ wfDebugLog( __CLASS__, __METHOD__ . ': Unable to render
snak' );
return '';
}
-
- $claims = $this->getClaimsForProperty( $entity, $propertyLabel
);
-
- if ( $claims->isEmpty() ) {
- wfProfileOut( __METHOD__ );
- return '';
- }
-
- $snakList = $claims->getMainSnaks();
- $text = $this->formatSnakList( $snakList, $propertyLabel );
-
- wfProfileOut( __METHOD__ );
- return $text;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/67900
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09c92f297c0f075fe50bc61128b3a9bdc737c072
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.22-wmf5
Gerrit-Owner: Aude <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits