Index: trunk/phase3/includes/api/ApiBlock.php |
— | — | @@ -157,6 +157,17 @@ |
158 | 158 | 'Block a user.' |
159 | 159 | ); |
160 | 160 | } |
| 161 | + |
| 162 | + public function possibleErrors() { |
| 163 | + return array ( |
| 164 | + $this->parseMsg( array( 'missingparam', 'user' ) ), |
| 165 | + $this->parseMsg( array( 'missingparam', 'token' ) ), |
| 166 | + $this->parseMsg( array( 'sessionfailure' ) ), |
| 167 | + $this->parseMsg( array( 'cantblock' ) ), |
| 168 | + $this->parseMsg( array( 'canthide' ) ), |
| 169 | + $this->parseMsg( array( 'cantblock-email' ) ), |
| 170 | + ); |
| 171 | + } |
161 | 172 | |
162 | 173 | protected function getExamples() { |
163 | 174 | return array ( |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -964,6 +964,12 @@ |
965 | 965 | return false; |
966 | 966 | } |
967 | 967 | |
| 968 | + /** |
| 969 | + * Returns a list of all possible errors returned by the module |
| 970 | + */ |
| 971 | + public function possibleErrors() { |
| 972 | + return array(); |
| 973 | + } |
968 | 974 | |
969 | 975 | /** |
970 | 976 | * Profiling: total module execution time |
Index: trunk/phase3/includes/api/ApiParamInfo.php |
— | — | @@ -96,6 +96,7 @@ |
97 | 97 | $retval['description'] = implode( "\n", (array)$obj->getDescription() ); |
98 | 98 | $retval['version'] = implode( "\n", (array)$obj->getVersion() ); |
99 | 99 | $retval['prefix'] = $obj->getModulePrefix(); |
| 100 | + |
100 | 101 | if ( $obj->isReadMode() ) |
101 | 102 | $retval['readrights'] = ''; |
102 | 103 | if ( $obj->isWriteMode() ) |
— | — | @@ -104,9 +105,11 @@ |
105 | 106 | $retval['mustbeposted'] = ''; |
106 | 107 | if ( $obj instanceof ApiQueryGeneratorBase ) |
107 | 108 | $retval['generator'] = ''; |
| 109 | + |
108 | 110 | $allowedParams = $obj->getFinalParams(); |
109 | 111 | if ( !is_array( $allowedParams ) ) |
110 | 112 | return $retval; |
| 113 | + |
111 | 114 | $retval['parameters'] = array(); |
112 | 115 | $paramDesc = $obj->getFinalParamDescription(); |
113 | 116 | foreach ( $allowedParams as $n => $p ) |
— | — | @@ -167,6 +170,11 @@ |
168 | 171 | $retval['parameters'][] = $a; |
169 | 172 | } |
170 | 173 | $result->setIndexedTagName( $retval['parameters'], 'param' ); |
| 174 | + |
| 175 | + // Errors |
| 176 | + $retval['errors'] = $obj->possibleErrors(); |
| 177 | + $result->setIndexedTagName( $retval['errors'], 'error' ); |
| 178 | + |
171 | 179 | return $retval; |
172 | 180 | } |
173 | 181 | |