Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/237357
Change subject: Always throw TermLookupException in EntityInfoTermLookup ...................................................................... Always throw TermLookupException in EntityInfoTermLookup Have the getLabel and getDescription methods delegate to getLabels and getDescriptions, which handles the OutOfBoundsException and then throws TermLookupException. @todo add tests for this Bug: T112003 Change-Id: Iff176d6ac834ca6138425e47ae0d101e436b276b --- M lib/includes/store/EntityInfoTermLookup.php 1 file changed, 16 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/57/237357/1 diff --git a/lib/includes/store/EntityInfoTermLookup.php b/lib/includes/store/EntityInfoTermLookup.php index 951acf7..8feb0db 100644 --- a/lib/includes/store/EntityInfoTermLookup.php +++ b/lib/includes/store/EntityInfoTermLookup.php @@ -42,24 +42,24 @@ * @return string|null */ public function getLabel( EntityId $entityId, $languageCode ) { - try { - return $this->entityInfo->getLabel( $entityId, $languageCode ); - } catch ( \OutOfBoundsException $ex ) { - throw new TermLookupException( $entityId, array( $languageCode ), $ex->getMessage(), $ex ); - } + return $this->getLabels( $entityId, array( $languageCode ) ); } /** * Gets all labels of an Entity with the specified EntityId. * * @param EntityId $entityId - * @param string[] $languages + * @param string[] $languageCodes * * @throws TermLookupException * @return string[] */ - public function getLabels( EntityId $entityId, array $languages ) { - return $this->entityInfo->getLabels( $entityId, $languages ); + public function getLabels( EntityId $entityId, array $languageCodes ) { + try { + return $this->entityInfo->getLabels( $entityId, $languageCodes ); + } catch ( \OutOfBoundsException $ex ) { + throw new TermLookupException( $entityId, $languageCodes, $ex->getMessage(), $ex ); + } } /** @@ -72,24 +72,24 @@ * @return string|null */ public function getDescription( EntityId $entityId, $languageCode ) { - try { - return $this->entityInfo->getDescription( $entityId, $languageCode ); - } catch ( \OutOfBoundsException $ex ) { - throw new TermLookupException( $entityId, array( $languageCode ), $ex->getMessage(), $ex ); - } + return $this->getDescription( $entityId, array( $languageCode ) ); } /** * Gets all descriptions of an Entity with the specified EntityId. * * @param EntityId $entityId - * @param string[] $languages + * @param string[] $languageCodes * * @throws TermLookupException * @return string[] */ - public function getDescriptions( EntityId $entityId, array $languages ) { - return $this->entityInfo->getDescriptions( $entityId, $languages ); + public function getDescriptions( EntityId $entityId, array $languageCodes ) { + try { + return $this->entityInfo->getDescriptions( $entityId, $languageCodes ); + } catch ( \OutOfBoundsException $ex ) { + throw new TermLookupException( $entityId, $languageCodes, $ex->getMessage(), $ex ); + } } } -- To view, visit https://gerrit.wikimedia.org/r/237357 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iff176d6ac834ca6138425e47ae0d101e436b276b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits