jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/372147 )
Change subject: Fix usages of dieWithError in CreateClaim
......................................................................
Fix usages of dieWithError in CreateClaim
This takes some parts of I0d2a4712353e8bf53dd7c0e4e8c0125201db3761 out of the
patch
Change-Id: I2bde59208cedfae201e841c0ebdeb20f27d231fd
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/Api/CreateClaim.php
3 files changed, 14 insertions(+), 5 deletions(-)
Approvals:
WMDE-leszek: Looks good to me, approved
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 9ab1fd6..14e3948 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -317,6 +317,8 @@
"wikibase-mylanguagefallbackchain-babel": "You can edit it by putting
<nowiki>{{#babel: }}</nowiki> on {{GENDER:$1|your}} [[Special:MyPage|user
page]].",
"wikibase-mylanguagefallbackchain-verbatim-item": "$1 - $2",
"wikibase-mylanguagefallbackchain-converted-item": "$1 - $2, converted
from $3 - $4",
+ "wikibase-api-claim-value-missing": "A value needs to be provided when
creating a claim with PropertyValueSnak snak.",
+ "wikibase-api-claim-value-unexpected": "You cannot provide a value when
creating a claim with no PropertyValueSnak as main snak.",
"wikibase-api-common-item": "Common item detected.",
"wikibase-api-badtoken": "Bad token detected.",
"wikibase-api-cant-load-entity-content": "Cannot access content,
revision may be deleted.",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 0b270c2..855419d 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -351,6 +351,8 @@
"wikibase-mylanguagefallbackchain-verbatim-item": "A \"verbatim\"
(taken from database and displayed as-is) fallback chain
item.\n\nParameters:\n* $1 - Language code\n* $2 - Language name",
"wikibase-mylanguagefallbackchain-converted-item": "A \"converted\"
(taken from data in another language and converted to another language on
display) fallback chain item.\n\nParameters:\n* $1 - Language code\n* $2 -
Language name\n* $3 - Source language code\n* $4 - Source language name",
"wikibase-api-common-item": "!!DO NOT TRANSLATE!! This is an error
message for a situation where a common item detected that should not",
+ "wikibase-api-claim-value-missing": "Error message returned from the
API when attempting to create a claim with no value.",
+ "wikibase-api-claim-value-unexpected": "Error message returned from the
API when attempting to specify a value while creating a non-value claim.",
"wikibase-api-badtoken": "!!DO NOT TRANSLATE!! This is an error message
for a situation where there are no or bad token given in the API call and it is
expected. Usually this should never be shown to the user, unless there are some
exceptional error conditions. The message can be shown after misconfiguration
of the system.",
"wikibase-api-cant-load-entity-content": "!!DO NOT TRANSLATE!! Shown
when we can't access the content revision. This could be because it has been
deleted, or because it belongs to a different entity.",
"wikibase-api-unresolved-redirect": "Error message returned from the
API when trying to use an entity ID that refers to a redirect in a context
where redirects are not supported.",
diff --git a/repo/includes/Api/CreateClaim.php
b/repo/includes/Api/CreateClaim.php
index 56837c7..1224620 100644
--- a/repo/includes/Api/CreateClaim.php
+++ b/repo/includes/Api/CreateClaim.php
@@ -114,25 +114,30 @@
private function validateParameters( array $params ) {
if ( $params['snaktype'] === 'value' xor isset(
$params['value'] ) ) {
if ( $params['snaktype'] === 'value' ) {
- $this->errorReporter->dieWithError( [
'param-missing', 'value' ],
+ $this->errorReporter->dieWithError(
+ [ 'wikibase-api-claim-value-missing' ],
'param-missing'
);
} else {
- $this->errorReporter->dieError(
- 'You cannot provide a value when
creating a claim with no PropertyValueSnak as main snak',
+ $this->errorReporter->dieWithError(
+ [ 'wikibase-api-claim-value-unexpected'
],
'param-illegal'
);
}
}
if ( !isset( $params['property'] ) ) {
- $this->errorReporter->dieWithError( [ 'param-missing',
'property' ],
+ $this->errorReporter->dieWithError(
+ [ 'wikibase-api-param-missing', 'property' ],
'param-missing'
);
}
if ( isset( $params['value'] ) && json_decode(
$params['value'], true ) === null ) {
- $this->errorReporter->dieError( 'Could not decode snak
value', 'invalid-snak' );
+ $this->errorReporter->dieWithError(
+ [ 'wikibase-api-invalid-snak' ],
+ 'invalid-snak'
+ );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/372147
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2bde59208cedfae201e841c0ebdeb20f27d231fd
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits