Merge "Update for API error i18n"

This commit is contained in:
jenkins-bot 2016-12-07 06:46:01 +00:00 committed by Gerrit Code Review
commit 640460b17c
3 changed files with 9 additions and 3 deletions

View file

@ -7,7 +7,11 @@ class ApiCategoryTree extends ApiBase {
if ( isset( $params['options'] ) ) {
$options = FormatJson::decode( $params['options'] );
if ( !is_object( $options ) ) {
$this->dieUsage( 'Options must be valid a JSON object', 'invalidjson' );
if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( 'apierror-categorytree-invalidjson', 'invalidjson' );
} else {
$this->dieUsage( 'Options must be valid a JSON object', 'invalidjson' );
}
return;
}
$options = get_object_vars( $options );

View file

@ -39,5 +39,6 @@
"categorytree-retry": "Please wait a moment and try again.",
"apihelp-categorytree-description": "Internal module for the CategoryTree extension.",
"apihelp-categorytree-param-category": "Title in the category namespace, prefix will be ignored if given.",
"apihelp-categorytree-param-options": "Options for the CategoryTree constructor as a JSON object. The <var>depth</var> option defaults to <kbd>1</kbd>."
"apihelp-categorytree-param-options": "Options for the CategoryTree constructor as a JSON object. The <var>depth</var> option defaults to <kbd>1</kbd>.",
"apierror-categorytree-invalidjson": "Options must be valid a JSON object."
}

View file

@ -57,5 +57,6 @@
"categorytree-retry": "Instruction to try again later",
"apihelp-categorytree-description": "{{doc-apihelp-description|categorytree}}",
"apihelp-categorytree-param-category": "{{doc-apihelp-param|categorytree|category}}",
"apihelp-categorytree-param-options": "{{doc-apihelp-param|categorytree|options}}"
"apihelp-categorytree-param-options": "{{doc-apihelp-param|categorytree|options}}",
"apierror-categorytree-invalidjson": "{{doc-apierror}}"
}