* Returns a list of all possible errors returned by the module
*/
public function possibleErrors() {
- return array();
+ $ret = array( array( 'readrequired' ) );
+
+ if ( $this->mustBePosted() ) {
+ $ret = array_merge( $ret, array( array( 'code' => 'mustbeposted', 'info' => 'The {$this->mAction} module requires a POST request' ) ) );
+ }
+
+ return $ret;
+ }
+
+ /**
+ *
+ */
+ public function parseErrors( $errors ) {
+ $ret = array();
+
+ foreach ( $errors as $row )
+ {
+ if ( isset( $row['code'] ) && isset( $row['info'] ) ) {
+ $ret[] = $row;
+ }
+ else {
+ $ret[] = $this->parseMsg( $row );
+ }
+ }
+ return $ret;
}
/**
}
public function possibleErrors() {
- return array (
- $this->parseMsg( array( 'missingparam', 'user' ) ),
- $this->parseMsg( array( 'missingparam', 'token' ) ),
- $this->parseMsg( array( 'sessionfailure' ) ),
- $this->parseMsg( array( 'cantblock' ) ),
- $this->parseMsg( array( 'canthide' ) ),
- $this->parseMsg( array( 'cantblock-email' ) ),
- );
+ return array_merge( parent::possibleErrors(), array(
+ array( 'missingparam', 'user' ),
+ array( 'missingparam', 'token' ),
+ array( 'sessionfailure' ),
+ array( 'cantblock' ),
+ array( 'canthide' ),
+ array( 'cantblock-email' ),
+ ) );
}
protected function getExamples() {
}
$result->setIndexedTagName( $retval['parameters'], 'param' );
- // Errors
- $retval['errors'] = $obj->possibleErrors();
+ // Errors
+ $retval['errors'] = $this->parseErrors( $obj->possibleErrors() );
+
$result->setIndexedTagName( $retval['errors'], 'error' );
return $retval;