Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/67932
Change subject: Handle failure to deserialize entity in lua ...................................................................... Handle failure to deserialize entity in lua Change-Id: I85e387b62ff0f940de31acec166c28ff389114ad --- M client/WikibaseClient.i18n.php M client/includes/WikibaseLibrary.php 2 files changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/32/67932/1 diff --git a/client/WikibaseClient.i18n.php b/client/WikibaseClient.i18n.php index a79bc9a..be8cea2 100644 --- a/client/WikibaseClient.i18n.php +++ b/client/WikibaseClient.i18n.php @@ -56,6 +56,7 @@ 'wikibase-rc-hide-wikidata' => '$1 Wikidata', 'wikibase-rc-show-wikidata-pref' => 'Show Wikidata edits in recent changes', 'wikibase-watchlist-show-changes-pref' => 'Show Wikidata edits in your watchlist', + 'wikibase-error-deserialize-error' => 'Failed to deserialize data', 'wikibase-error-invalid-entity-id' => 'The ID entered is unknown to the system. Please use a valid entity ID.', 'special-unconnectedpages' => 'Pages not connected to items', 'wikibase-unconnectedpages-legend' => 'Unconnected pages options', @@ -152,6 +153,7 @@ * $1 - a link with the text {{msg-mw|show}} or {{msg-mw|hide}}', 'wikibase-rc-show-wikidata-pref' => 'Option in the recent changes section of preferences to show wikibase changes by default in recent changes.', 'wikibase-watchlist-show-changes-pref' => 'Option in the watchlist section of preferences to always show wikibase edits by default in the watchlist.', + 'wikibase-error-deserialize-error' => 'Generic error for when entity data failed to deserialize or cannot be handled.', 'wikibase-error-invalid-entity-id' => 'Generic error message when an invalid entity ID was entered.', 'special-unconnectedpages' => '{{doc-special|UnconnectedPages}}', 'wikibase-unconnectedpages-legend' => 'Legend for the options box at the special page for pages not connected to sitelinks.', diff --git a/client/includes/WikibaseLibrary.php b/client/includes/WikibaseLibrary.php index 8039c60..2dcadb7 100644 --- a/client/includes/WikibaseLibrary.php +++ b/client/includes/WikibaseLibrary.php @@ -78,8 +78,12 @@ $opt = new \Wikibase\Lib\Serializers\EntitySerializationOptions(); $serializer->setOptions( $opt ); - $entityArr = $serializer->getSerialized( $entityObject ); - return array( $entityArr ); + try { + $entityArr = $serializer->getSerialized( $entityObject ); + return array( $entityArr ); + } catch ( \Exception $e ) { + throw $this->getEngine()->newException( 'wikibase-error-deserialize-error' ); + } } /** -- To view, visit https://gerrit.wikimedia.org/r/67932 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I85e387b62ff0f940de31acec166c28ff389114ad Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: mw1.22-wmf5 Gerrit-Owner: Aude <aude.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits