Aude has uploaded a new change for review.

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


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/87/67987/1

diff --git a/client/WikibaseClient.i18n.php b/client/WikibaseClient.i18n.php
index 0f5e411..af24301 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-serialize-error' => 'Failed to serialize 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',
@@ -157,6 +158,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-serialize-error' => 'Generic error for when entity data 
failed to serialize 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..17bb45c 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-serialize-error' );
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/67987
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: 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

Reply via email to