Rest of dieUsageMsg in getPossibleErrors
authorSam Reed <reedy@users.mediawiki.org>
Sat, 13 Feb 2010 00:28:27 +0000 (00:28 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 13 Feb 2010 00:28:27 +0000 (00:28 +0000)
13 files changed:
includes/api/ApiDelete.php
includes/api/ApiEditPage.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiImport.php
includes/api/ApiMove.php
includes/api/ApiPatrol.php
includes/api/ApiProtect.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryRevisions.php
includes/api/ApiRollback.php
includes/api/ApiUndelete.php
includes/api/ApiWatch.php

index 5efdcfc..af64a2f 100644 (file)
@@ -209,6 +209,16 @@ class ApiDelete extends ApiBase {
                        'Delete a page.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'token' ),
+                       array( 'invalidtitle', 'title' ),
+                       array( 'nosuchpageid', 'pageid' ),
+                       array( 'notanarticle' ),
+                       array( 'hookaborted', 'error' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
@@ -220,4 +230,4 @@ class ApiDelete extends ApiBase {
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
-}
+}
\ No newline at end of file
index a0978d7..9a9b597 100644 (file)
@@ -345,6 +345,46 @@ class ApiEditPage extends ApiBase {
        protected function getDescription() {
                return 'Create and edit pages.';
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'title' ),
+                       array( 'missingtext' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'sessionfailure' ),
+                       array( 'invalidtitle', 'title' ),
+                       array( 'createonly-exists' ),
+                       array( 'nocreate-missing' ),
+                       array( 'nosuchrevid', 'undo' ),
+                       array( 'nosuchrevid', 'undoafter' ),
+                       array( 'revwrongpage', 'id', 'text' ),
+                       array( 'revwrongpage', 'id', 'text' ),
+                       array( 'undo-failure' ),
+                       array( 'hashcheckfailed' ),
+                       array( 'hookaborted' ),
+                       array( 'hookaborted' ),
+                       array( 'noimageredirect-anon' ),
+                       array( 'noimageredirect-logged' ),
+                       array( 'spamdetected', 'spam' ),
+                       array( 'filtered' ),
+                       array( 'blockedtext' ),
+                       array( 'contenttoobig', $this->getMaxArticleSize() ),
+                       array( 'noedit-anon' ),
+                       array( 'noedit' ),
+                       array( 'actionthrottledtext' ),
+                       array( 'wasdeleted' ),
+                       array( 'nocreate-loggedin' ),
+                       array( 'blankpage' ),
+                       array( 'editconflict' ),
+                       array( 'emptynewsection' ),
+                       array( 'unknownerror', 'retval' ),
+        ) );
+       }
+
+       private function getMaxArticleSize() {
+               global $wgMaxArticleSize;
+               return $wgMaxArticleSize;
+       }
 
        protected function getAllowedParams() {
                return array (
index 308f229..a96fc31 100644 (file)
@@ -116,7 +116,6 @@ class ApiFeedWatchlist extends ApiBase {
                        $feedFormat = isset( $params['feedformat'] ) ? $params['feedformat'] : 'rss';
                        $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl );
 
-
                        if ( $e instanceof UsageException ) {
                                $errorCode = $e->getCodeString();
                        } else {
index a57217f..c2b2f25 100644 (file)
@@ -140,6 +140,18 @@ class ApiImport extends ApiBase {
                        'Import a page from another wiki, or an XML file'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'cantimport' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'sessionfailure' ),
+                       array( 'missingparam', 'interwikipage' ),
+                       array( 'cantimport-upload' ),
+                       array( 'import-unknownerror', 'source' ),
+                       array( 'import-unknownerror', 'result' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array(
@@ -176,4 +188,4 @@ class ApiImportReporter extends ImportReporter {
        {
                return $this->mResultArr;
        }
-}
+}
\ No newline at end of file
index e1ba722..b9d41fb 100644 (file)
@@ -209,6 +209,19 @@ class ApiMove extends ApiBase {
                        'Move a page.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'to' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'sessionfailure' ),
+                       array( 'invalidtitle', 'from' ),
+                       array( 'nosuchpageid', 'fromid' ),
+                       array( 'notanarticle' ),
+                       array( 'invalidtitle', 'to' ),
+                       array( 'sharedfile-exists' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index 462593f..bd97c0a 100644 (file)
@@ -89,6 +89,15 @@ class ApiPatrol extends ApiBase {
                        'Patrol a page or revision. '
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'token' ),
+                       array( 'missingparam', 'rcid' ),
+                       array( 'sessionfailure' ),
+                       array( 'nosuchrcid', 'rcid' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array(
@@ -99,4 +108,4 @@ class ApiPatrol extends ApiBase {
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
-}
+}
\ No newline at end of file
index 2253dc9..34283f2 100644 (file)
@@ -171,6 +171,23 @@ class ApiProtect extends ApiBase {
                        'Change the protection level of a page.'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'title' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'missingparam', 'protections' ),
+                       array( 'sessionfailure' ),
+                       array( 'invalidtitle', 'title' ),
+                       array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ) ),
+                       array( 'create-titleexists' ),
+                       array( 'missingtitle-createonly' ),
+                       array( 'protect-invalidaction', 'action'] ),
+                       array( 'protect-invalidlevel', 'level' ),
+                       array( 'invalidexpiry', 'expiry' ),
+                       array( 'pastexpiry', 'expiry' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index 49f30ba..2a76544 100644 (file)
@@ -453,6 +453,13 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                                ApiBase :: dieDebug( __METHOD__, 'Unknown module name' );
                }
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'invalidtitle', 'title' ),
+                       array( 'missingparam', 'title' ),
+        ) );
+       }
 
        protected function getExamples() {
                static $examples = array (
index d44a2f3..252d25e 100644 (file)
@@ -407,6 +407,13 @@ abstract class ApiQueryBase extends ApiBase {
        public function keyPartToTitle( $keyPart ) {
                return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'invalidtitle', 'title' ),
+                       array( 'invalidtitle', 'key' ),
+        ) );
+       }
 
        /**
         * Get version string for use in the API help output
index bf2b2ba..29be3ca 100644 (file)
@@ -560,6 +560,12 @@ class ApiQueryRevisions extends ApiQueryBase {
                        'All parameters marked as (enum) may only be used with a single page (#2).'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'nosuchrevid', 'diffto' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index 3e8ea31..cc9c470 100644 (file)
@@ -113,6 +113,17 @@ class ApiRollback extends ApiBase {
                                'they will all be rolled back.'
                        );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'title' ),
+                       array( 'missingparam', 'user' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'invalidtitle', 'title' ),
+                       array( 'notanarticle' ),
+                       array( 'invaliduser', 'user' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index a0e6e9b..d594d1f 100644 (file)
@@ -117,6 +117,18 @@ class ApiUndelete extends ApiBase {
                        'retrieved through list=deletedrevs'
                );
        }
+       
+    public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'missingparam', 'title' ),
+                       array( 'missingparam', 'token' ),
+                       array( 'permdenied-undelete' ),
+                       array( 'blockedtext' ),
+                       array( 'sessionfailure' ),
+                       array( 'invalidtitle', 'title' ),
+                       array( 'cannotundelete' ),
+        ) );
+       }
 
        protected function getExamples() {
                return array (
index 06d4a01..1c3688a 100644 (file)
@@ -91,6 +91,14 @@ class ApiWatch extends ApiBase {
                        'Add or remove a page from/to the current user\'s watchlist'
                );
        }
+       
+       public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
+                       array( 'invalidtitle', 'title' ),
+                       array( 'hookaborted' ),
+               ) );
+       }
 
        protected function getExamples() {
                return array(