Bene has uploaded a new change for review.
https://gerrit.wikimedia.org/r/270289
Change subject: Add missing api error messages
......................................................................
Add missing api error messages
This adds missing api error messages to the api modules and the json
files.
Also fixed a typo in the messages file.
Change-Id: I0b15385faf4062ffef2dc1037bc6033401babe20
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/api/EditEntity.php
M repo/includes/api/SetAliases.php
M repo/includes/api/SetDescription.php
M repo/includes/api/SetLabel.php
6 files changed, 21 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/89/270289/1
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index e630e69..5f783e8 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -309,7 +309,7 @@
"wikibase-api-invalid-list": "Invalid list",
"wikibase-api-invalid-property-id": "Invalid property id",
"wikibase-api-invalid-entity-id": "Invalid entity id",
- "wikibase-api-no-common-iten": "There is no common item",
+ "wikibase-api-no-common-item": "There is no common item",
"wikibase-api-no-data": "No data to operate on",
"wikibase-api-no-external-page": "The external client site '$1' did not
provide page information for page '$2'.",
"wikibase-api-nosuchrevid": "Revision with id not found",
@@ -321,6 +321,7 @@
"wikibase-api-no-such-site": "Could not find such a site",
"wikibase-api-no-such-sitelink": "Could not find a sitelink to '$1'
when trying to edit badges.",
"wikibase-api-no-such-statement": "Could not find such a statement",
+ "wikibase-api-not-supported": "The requested feature is not supported
by the given entity.",
"wikibase-api-not-statement": "Not a statement",
"wikibase-api-not-item": "Not an item",
"wikibase-api-not-recognized-siteid": "The supplied site identifier was
not recognized",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 4bb0da2..f2cb76d 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -340,7 +340,7 @@
"wikibase-api-invalid-list": "!!DO NOT TRANSLATE!! Invalid list or data
has been provided. This can occour when a list conflicts with itself (the list
contains something to modify, but also to remove this item)",
"wikibase-api-invalid-property-id": "!!DO NOT TRANSLATE!! Invalid
propertyid has been supplied",
"wikibase-api-invalid-entity-id": "!!DO NOT TRANSLATE!! Invalid
entityid has been supplied",
- "wikibase-api-no-common-iten": "!!DO NOT TRANSLATE!! There is no common
item between to passed parameters when there should be",
+ "wikibase-api-no-common-item": "!!DO NOT TRANSLATE!! There is no common
item between to passed parameters when there should be",
"wikibase-api-no-data": "!!DO NOT TRANSLATE!! This is an error message
for a situation where the \"data\" argument to the API is lacking content.
Usually this should never be shown to the user, unless there are some
exceptional error condition. This message should probably not exist in the
final version.",
"wikibase-api-no-external-page": "This is an error message where the
external client did reply, but either because of a faulty reply or because the
page title could not be unwound, it was not possible to identify an external
page.\n* $1 - the site id\n* $2 - the page id",
"wikibase-api-nosuchrevid": "!!DO NOT TRANSLATE!! Page or entity with
this revision id could not be found in the database",
@@ -352,6 +352,7 @@
"wikibase-api-no-such-site": "!!DO NOT TRANSLATE!! Could not find such
a site, this could be to the user entering the wrong data",
"wikibase-api-no-such-sitelink": "Could not find such a sitelink, this
could be to the user entering the wrong data\n* $1 - the site id",
"wikibase-api-no-such-statement": "!!DO NOT TRANSLATE!! Could not find
such a statement, this could be to the user entering the wrong data",
+ "wikibase-api-not-supported": "!!DO NOT TRANSLATE!! The given entity
does not support the operation provided by the requested api module.",
"wikibase-api-not-statement": "!!DO NOT TRANSLATE!! The passed
parameter is Not a statement when a statement is expected",
"wikibase-api-not-item": "!!DO NOT TRANSLATE!! The passed parameter is
Not an item when an item is expected (the passed parameter may infact be a
property)",
"wikibase-api-not-recognized-siteid": "!!DO NOT TRANSLATE!! The
supplied site identifier was not recognized",
diff --git a/repo/includes/api/EditEntity.php b/repo/includes/api/EditEntity.php
index 48e9966..7d68fff 100644
--- a/repo/includes/api/EditEntity.php
+++ b/repo/includes/api/EditEntity.php
@@ -22,7 +22,9 @@
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Statement\Statement;
+use Wikibase\DataModel\Statement\StatementListHolder;
use Wikibase\DataModel\Statement\StatementListProvider;
+use Wikibase\DataModel\Term\FingerprintHolder;
use Wikibase\DataModel\Term\FingerprintProvider;
use Wikibase\EntityFactory;
use Wikibase\Lib\ContentLanguages;
@@ -313,16 +315,25 @@
// for more efficient validation!
if ( array_key_exists( 'labels', $data ) ) {
+ if ( !( $entity instanceof FingerprintHolder ) ) {
+ $this->errorReporter->dieError( 'The given
entity does not contain labels', 'not-recognized' );
+ }
$this->assertArray( $data['labels'], 'List of labels
must be an array' );
$changeOps->add( $this->getLabelChangeOps(
$data['labels'] ) );
}
if ( array_key_exists( 'descriptions', $data ) ) {
+ if ( !( $entity instanceof FingerprintHolder ) ) {
+ $this->errorReporter->dieError( 'The given
entity does not contain descriptions', 'not-recognized' );
+ }
$this->assertArray( $data['descriptions'], 'List of
descriptions must be an array' );
$changeOps->add( $this->getDescriptionChangeOps(
$data['descriptions'] ) );
}
if ( array_key_exists( 'aliases', $data ) ) {
+ if ( !( $entity instanceof FingerprintHolder ) ) {
+ $this->errorReporter->dieError( 'The given
entity does not contain aliases', 'not-recognized' );
+ }
$this->assertArray( $data['aliases'], 'List of aliases
must be an array' );
$changeOps->add( $this->getAliasesChangeOps(
$data['aliases'] ) );
}
@@ -336,6 +347,9 @@
}
if ( array_key_exists( 'claims', $data ) ) {
+ if ( !( $entity instanceof StatementListHolder ) ) {
+ $this->errorReporter->dieError( 'The given
entity does not contain statements', 'not-recognized' );
+ }
$this->assertArray( $data['claims'], 'List of claims
must be an array' );
$changeOps->add( $this->getClaimsChangeOps(
$data['claims'] ) );
}
diff --git a/repo/includes/api/SetAliases.php b/repo/includes/api/SetAliases.php
index 5c29c4d..83a5f18 100644
--- a/repo/includes/api/SetAliases.php
+++ b/repo/includes/api/SetAliases.php
@@ -103,7 +103,7 @@
*/
protected function modifyEntity( EntityDocument &$entity, array
$params, $baseRevId ) {
if ( !( $entity instanceof FingerprintProvider ) ) {
- $this->errorReporter->dieError( 'The given entity does
not contain aliases', 'no-aliases' );
+ $this->errorReporter->dieError( 'The given entity does
not contain aliases', 'not-supported' );
}
$summary = $this->createSummary( $params );
diff --git a/repo/includes/api/SetDescription.php
b/repo/includes/api/SetDescription.php
index c64f33c..5e8a966 100644
--- a/repo/includes/api/SetDescription.php
+++ b/repo/includes/api/SetDescription.php
@@ -54,7 +54,7 @@
*/
protected function modifyEntity( EntityDocument &$entity, array
$params, $baseRevId ) {
if ( !( $entity instanceof FingerprintProvider ) ) {
- $this->errorReporter->dieError( 'The given entity does
not contain descriptions', 'no-descriptions' );
+ $this->errorReporter->dieError( 'The given entity does
not contain descriptions', 'not-supported' );
}
$summary = $this->createSummary( $params );
diff --git a/repo/includes/api/SetLabel.php b/repo/includes/api/SetLabel.php
index 6ac651d..6c8af90 100644
--- a/repo/includes/api/SetLabel.php
+++ b/repo/includes/api/SetLabel.php
@@ -54,7 +54,7 @@
*/
protected function modifyEntity( EntityDocument &$entity, array
$params, $baseRevId ) {
if ( !( $entity instanceof FingerprintProvider ) ) {
- $this->errorReporter->dieError( 'The given entity does
not contain labels', 'no-labels' );
+ $this->errorReporter->dieError( 'The given entity does
not contain labels', 'not-supported' );
}
$summary = $this->createSummary( $params );
--
To view, visit https://gerrit.wikimedia.org/r/270289
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b15385faf4062ffef2dc1037bc6033401babe20
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits