Start of blanket coverage of dieUsageMsg in getPossibleErrors
authorSam Reed <reedy@users.mediawiki.org>
Sat, 13 Feb 2010 00:09:05 +0000 (00:09 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 13 Feb 2010 00:09:05 +0000 (00:09 +0000)
Only basic ones done.

Couple of other modules done manually

includes/api/ApiEmailUser.php
includes/api/ApiFormatXml.php
includes/api/ApiLogin.php
includes/api/ApiMain.php
includes/api/ApiPurge.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiUnblock.php
includes/api/ApiUpload.php
includes/api/ApiUserrights.php

index 469fe37..12abc26 100644 (file)
@@ -103,6 +103,15 @@ class ApiEmailUser extends ApiBase {
                        'Email a user.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'usermaildisabled' ),
+                       array( 'missingparam', 'target' ),
+                       array( 'missingparam', 'text' ),
+                       array( 'missingparam', 'token' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index f4342a4..413e4a4 100644 (file)
@@ -190,7 +190,6 @@ class ApiFormatXml extends ApiFormatBase {
                );
        }
 
-
        public function getDescription() {
                return 'Output data in XML format' . parent :: getDescription();
        }
index 66f843d..720fcb8 100644 (file)
@@ -167,6 +167,21 @@ class ApiLogin extends ApiBase {
                        'This is to prevent password guessing by automated password crackers.'
                );
        }
+       
+       public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array (
+            array( 'code' => 'NoName', 'info' => 'You didn\'t set the lgname parameter' ),
+            array( 'code' => 'Illegal', 'info' => ' You provided an illegal username' ),
+            array( 'code' => 'NotExists', 'info' => ' The username you provided doesn\'t exist' ),
+            array( 'code' => 'EmptyPass', 'info' => ' You didn\'t set the lgpassword parameter or you left it empty' ),
+            array( 'code' => 'WrongPass', 'info' => ' The password you provided is incorrect' ),
+            array( 'code' => 'WrongPluginPass', 'info' => 'Same as `WrongPass", returned when an authentication plugin rather than MediaWiki itself rejected the password' ),
+            array( 'code' => 'CreateBlocked', 'info' => 'The wiki tried to automatically create a new account for you, but your IP address has been blocked from account creation' ),
+            array( 'code' => 'Throttled', 'info' => 'You\'ve logged in too many times in a short time' ),
+            array( 'code' => 'Blocked', 'info' => 'User is blocked' ),
+        ) );
+;
+       }
 
        protected function getExamples() {
                return array(
index ad010f1..2a48f77 100644 (file)
@@ -539,6 +539,12 @@ class ApiMain extends ApiBase {
                        '',
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'readonlytext' ),
+        ) );
+       }
 
        /**
         * Returns an array of strings with credits for the API
index aa6bc41..6bcecc7 100644 (file)
@@ -102,6 +102,13 @@ class ApiPurge extends ApiBase {
                        'Purge the cache for the given titles.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'cantpurge' ),
+                       array( 'missingparam', 'titles' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array(
index 415739e..0d35742 100644 (file)
@@ -482,6 +482,12 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                return 'Return general information about the site.';
        }
 
+       public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'code' => 'includeAllDenied', 'info' => 'Cannot view all servers info unless $wgShowHostnames is true',  ),
+               ) );
+       }
+
        protected function getExamples() {
                return array(
                        'api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics',
index b501eb0..386dcbc 100644 (file)
@@ -108,6 +108,16 @@ class ApiUnblock extends ApiBase {
                        'Unblock a user.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'unblock-notarget' ),
+                       array( 'unblock-idanduser' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'sessionfailure' ),
+                       array( 'cantunblock' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index c995326..2d8f739 100644 (file)
@@ -326,6 +326,21 @@ class ApiUpload extends ApiBase {
                        'log out and then log back in). Also you must get and send an edit token before doing any upload stuff.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'uploaddisabled' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'sessionfailure' ),
+                       array( 'invalid-session-key' ),
+                       array( 'uploaddisabled' ),
+                       array( 'badaccess-groups' ),
+                       array( 'missingparam', 'filename' ),
+                       array( 'mustbeloggedin', 'upload' ),
+                       array( 'badaccess-groups' ),
+                       array( 'badaccess-groups' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array(
index a8ccb32..e5ffe4e 100644 (file)
@@ -105,6 +105,14 @@ class ApiUserrights extends ApiBase {
                        'Add/remove a user to/from groups',
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'user' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'sessionfailure' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (