Index: trunk/phase3/includes/api/ApiWatch.php |
— | — | @@ -91,6 +91,14 @@ |
92 | 92 | 'Add or remove a page from/to the current user\'s watchlist' |
93 | 93 | ); |
94 | 94 | } |
| 95 | + |
| 96 | + public function getPossibleErrors() { |
| 97 | + return array_merge( parent::getPossibleErrors(), array( |
| 98 | + array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ), |
| 99 | + array( 'invalidtitle', 'title' ), |
| 100 | + array( 'hookaborted' ), |
| 101 | + ) ); |
| 102 | + } |
95 | 103 | |
96 | 104 | protected function getExamples() { |
97 | 105 | return array( |
Index: trunk/phase3/includes/api/ApiMove.php |
— | — | @@ -209,6 +209,19 @@ |
210 | 210 | 'Move a page.' |
211 | 211 | ); |
212 | 212 | } |
| 213 | + |
| 214 | + public function getPossibleErrors() { |
| 215 | + return array_merge( parent::getPossibleErrors(), array( |
| 216 | + array( 'missingparam', 'to' ), |
| 217 | + array( 'missingparam', 'token' ), |
| 218 | + array( 'sessionfailure' ), |
| 219 | + array( 'invalidtitle', 'from' ), |
| 220 | + array( 'nosuchpageid', 'fromid' ), |
| 221 | + array( 'notanarticle' ), |
| 222 | + array( 'invalidtitle', 'to' ), |
| 223 | + array( 'sharedfile-exists' ), |
| 224 | + ) ); |
| 225 | + } |
213 | 226 | |
214 | 227 | protected function getExamples() { |
215 | 228 | return array ( |
Index: trunk/phase3/includes/api/ApiProtect.php |
— | — | @@ -171,6 +171,23 @@ |
172 | 172 | 'Change the protection level of a page.' |
173 | 173 | ); |
174 | 174 | } |
| 175 | + |
| 176 | + public function getPossibleErrors() { |
| 177 | + return array_merge( parent::getPossibleErrors(), array( |
| 178 | + array( 'missingparam', 'title' ), |
| 179 | + array( 'missingparam', 'token' ), |
| 180 | + array( 'missingparam', 'protections' ), |
| 181 | + array( 'sessionfailure' ), |
| 182 | + array( 'invalidtitle', 'title' ), |
| 183 | + array( 'toofewexpiries', 'noofexpiries', 'noofprotections' ) ), |
| 184 | + array( 'create-titleexists' ), |
| 185 | + array( 'missingtitle-createonly' ), |
| 186 | + array( 'protect-invalidaction', 'action'] ), |
| 187 | + array( 'protect-invalidlevel', 'level' ), |
| 188 | + array( 'invalidexpiry', 'expiry' ), |
| 189 | + array( 'pastexpiry', 'expiry' ), |
| 190 | + ) ); |
| 191 | + } |
175 | 192 | |
176 | 193 | protected function getExamples() { |
177 | 194 | return array ( |
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php |
— | — | @@ -453,6 +453,13 @@ |
454 | 454 | ApiBase :: dieDebug( __METHOD__, 'Unknown module name' ); |
455 | 455 | } |
456 | 456 | } |
| 457 | + |
| 458 | + public function getPossibleErrors() { |
| 459 | + return array_merge( parent::getPossibleErrors(), array( |
| 460 | + array( 'invalidtitle', 'title' ), |
| 461 | + array( 'missingparam', 'title' ), |
| 462 | + ) ); |
| 463 | + } |
457 | 464 | |
458 | 465 | protected function getExamples() { |
459 | 466 | static $examples = array ( |
Index: trunk/phase3/includes/api/ApiRollback.php |
— | — | @@ -113,6 +113,17 @@ |
114 | 114 | 'they will all be rolled back.' |
115 | 115 | ); |
116 | 116 | } |
| 117 | + |
| 118 | + public function getPossibleErrors() { |
| 119 | + return array_merge( parent::getPossibleErrors(), array( |
| 120 | + array( 'missingparam', 'title' ), |
| 121 | + array( 'missingparam', 'user' ), |
| 122 | + array( 'missingparam', 'token' ), |
| 123 | + array( 'invalidtitle', 'title' ), |
| 124 | + array( 'notanarticle' ), |
| 125 | + array( 'invaliduser', 'user' ), |
| 126 | + ) ); |
| 127 | + } |
117 | 128 | |
118 | 129 | protected function getExamples() { |
119 | 130 | return array ( |
Index: trunk/phase3/includes/api/ApiQueryBase.php |
— | — | @@ -407,6 +407,13 @@ |
408 | 408 | public function keyPartToTitle( $keyPart ) { |
409 | 409 | return substr( $this->keyToTitle( $keyPart . 'x' ), 0, - 1 ); |
410 | 410 | } |
| 411 | + |
| 412 | + public function getPossibleErrors() { |
| 413 | + return array_merge( parent::getPossibleErrors(), array( |
| 414 | + array( 'invalidtitle', 'title' ), |
| 415 | + array( 'invalidtitle', 'key' ), |
| 416 | + ) ); |
| 417 | + } |
411 | 418 | |
412 | 419 | /** |
413 | 420 | * Get version string for use in the API help output |
Index: trunk/phase3/includes/api/ApiDelete.php |
— | — | @@ -209,6 +209,16 @@ |
210 | 210 | 'Delete a page.' |
211 | 211 | ); |
212 | 212 | } |
| 213 | + |
| 214 | + public function getPossibleErrors() { |
| 215 | + return array_merge( parent::getPossibleErrors(), array( |
| 216 | + array( 'missingparam', 'token' ), |
| 217 | + array( 'invalidtitle', 'title' ), |
| 218 | + array( 'nosuchpageid', 'pageid' ), |
| 219 | + array( 'notanarticle' ), |
| 220 | + array( 'hookaborted', 'error' ), |
| 221 | + ) ); |
| 222 | + } |
213 | 223 | |
214 | 224 | protected function getExamples() { |
215 | 225 | return array ( |
— | — | @@ -220,4 +230,4 @@ |
221 | 231 | public function getVersion() { |
222 | 232 | return __CLASS__ . ': $Id$'; |
223 | 233 | } |
224 | | -} |
| 234 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/api/ApiImport.php |
— | — | @@ -140,6 +140,18 @@ |
141 | 141 | 'Import a page from another wiki, or an XML file' |
142 | 142 | ); |
143 | 143 | } |
| 144 | + |
| 145 | + public function getPossibleErrors() { |
| 146 | + return array_merge( parent::getPossibleErrors(), array( |
| 147 | + array( 'cantimport' ), |
| 148 | + array( 'missingparam', 'token' ), |
| 149 | + array( 'sessionfailure' ), |
| 150 | + array( 'missingparam', 'interwikipage' ), |
| 151 | + array( 'cantimport-upload' ), |
| 152 | + array( 'import-unknownerror', 'source' ), |
| 153 | + array( 'import-unknownerror', 'result' ), |
| 154 | + ) ); |
| 155 | + } |
144 | 156 | |
145 | 157 | protected function getExamples() { |
146 | 158 | return array( |
— | — | @@ -176,4 +188,4 @@ |
177 | 189 | { |
178 | 190 | return $this->mResultArr; |
179 | 191 | } |
180 | | -} |
| 192 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -345,7 +345,47 @@ |
346 | 346 | protected function getDescription() { |
347 | 347 | return 'Create and edit pages.'; |
348 | 348 | } |
| 349 | + |
| 350 | + public function getPossibleErrors() { |
| 351 | + return array_merge( parent::getPossibleErrors(), array( |
| 352 | + array( 'missingparam', 'title' ), |
| 353 | + array( 'missingtext' ), |
| 354 | + array( 'missingparam', 'token' ), |
| 355 | + array( 'sessionfailure' ), |
| 356 | + array( 'invalidtitle', 'title' ), |
| 357 | + array( 'createonly-exists' ), |
| 358 | + array( 'nocreate-missing' ), |
| 359 | + array( 'nosuchrevid', 'undo' ), |
| 360 | + array( 'nosuchrevid', 'undoafter' ), |
| 361 | + array( 'revwrongpage', 'id', 'text' ), |
| 362 | + array( 'revwrongpage', 'id', 'text' ), |
| 363 | + array( 'undo-failure' ), |
| 364 | + array( 'hashcheckfailed' ), |
| 365 | + array( 'hookaborted' ), |
| 366 | + array( 'hookaborted' ), |
| 367 | + array( 'noimageredirect-anon' ), |
| 368 | + array( 'noimageredirect-logged' ), |
| 369 | + array( 'spamdetected', 'spam' ), |
| 370 | + array( 'filtered' ), |
| 371 | + array( 'blockedtext' ), |
| 372 | + array( 'contenttoobig', $this->getMaxArticleSize() ), |
| 373 | + array( 'noedit-anon' ), |
| 374 | + array( 'noedit' ), |
| 375 | + array( 'actionthrottledtext' ), |
| 376 | + array( 'wasdeleted' ), |
| 377 | + array( 'nocreate-loggedin' ), |
| 378 | + array( 'blankpage' ), |
| 379 | + array( 'editconflict' ), |
| 380 | + array( 'emptynewsection' ), |
| 381 | + array( 'unknownerror', 'retval' ), |
| 382 | + ) ); |
| 383 | + } |
349 | 384 | |
| 385 | + private function getMaxArticleSize() { |
| 386 | + global $wgMaxArticleSize; |
| 387 | + return $wgMaxArticleSize; |
| 388 | + } |
| 389 | + |
350 | 390 | protected function getAllowedParams() { |
351 | 391 | return array ( |
352 | 392 | 'title' => null, |
Index: trunk/phase3/includes/api/ApiPatrol.php |
— | — | @@ -89,6 +89,15 @@ |
90 | 90 | 'Patrol a page or revision. ' |
91 | 91 | ); |
92 | 92 | } |
| 93 | + |
| 94 | + public function getPossibleErrors() { |
| 95 | + return array_merge( parent::getPossibleErrors(), array( |
| 96 | + array( 'missingparam', 'token' ), |
| 97 | + array( 'missingparam', 'rcid' ), |
| 98 | + array( 'sessionfailure' ), |
| 99 | + array( 'nosuchrcid', 'rcid' ), |
| 100 | + ) ); |
| 101 | + } |
93 | 102 | |
94 | 103 | protected function getExamples() { |
95 | 104 | return array( |
— | — | @@ -99,4 +108,4 @@ |
100 | 109 | public function getVersion() { |
101 | 110 | return __CLASS__ . ': $Id$'; |
102 | 111 | } |
103 | | -} |
| 112 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/api/ApiUndelete.php |
— | — | @@ -117,6 +117,18 @@ |
118 | 118 | 'retrieved through list=deletedrevs' |
119 | 119 | ); |
120 | 120 | } |
| 121 | + |
| 122 | + public function getPossibleErrors() { |
| 123 | + return array_merge( parent::getPossibleErrors(), array( |
| 124 | + array( 'missingparam', 'title' ), |
| 125 | + array( 'missingparam', 'token' ), |
| 126 | + array( 'permdenied-undelete' ), |
| 127 | + array( 'blockedtext' ), |
| 128 | + array( 'sessionfailure' ), |
| 129 | + array( 'invalidtitle', 'title' ), |
| 130 | + array( 'cannotundelete' ), |
| 131 | + ) ); |
| 132 | + } |
121 | 133 | |
122 | 134 | protected function getExamples() { |
123 | 135 | return array ( |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -560,6 +560,12 @@ |
561 | 561 | 'All parameters marked as (enum) may only be used with a single page (#2).' |
562 | 562 | ); |
563 | 563 | } |
| 564 | + |
| 565 | + public function getPossibleErrors() { |
| 566 | + return array_merge( parent::getPossibleErrors(), array( |
| 567 | + array( 'nosuchrevid', 'diffto' ), |
| 568 | + ) ); |
| 569 | + } |
564 | 570 | |
565 | 571 | protected function getExamples() { |
566 | 572 | return array ( |
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php |
— | — | @@ -116,7 +116,6 @@ |
117 | 117 | $feedFormat = isset( $params['feedformat'] ) ? $params['feedformat'] : 'rss'; |
118 | 118 | $feed = new $wgFeedClasses[$feedFormat] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl ); |
119 | 119 | |
120 | | - |
121 | 120 | if ( $e instanceof UsageException ) { |
122 | 121 | $errorCode = $e->getCodeString(); |
123 | 122 | } else { |