Page MenuHomePhabricator

List possible errors in action=paraminfo
Closed, ResolvedPublic

Description

I am missing a listing of all possible errors with his description which can be thrown by api.

With this information the programmer can handled all errors in the right place.

Maybe allow listing of all errors for each module.

Thanks.


Version: unspecified
Severity: enhancement
URL: http://www.mediawiki.org/wiki/API:Errors_and_warnings

Details

Reference
bz18771

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:37 PM
bzimport set Reference to bz18771.

(In reply to comment #0)

I am missing a listing of all possible errors with his description which can be
thrown by api.

With this information the programmer can handled all errors in the right place.

Maybe allow listing of all errors for each module.

Thanks.

This is already documented per-module, at each module's description page. Listing this stuff through action=paraminfo was a suggestion Trevor also made a few weeks ago, so I'll repurpose the bug for that.

Roan, any thoughts on how to implement this?

Something i can keep poking at when i get 5 minutes etc..

ApiLogin

public function getErrors() {

		return array (
			'NoName' => 'You didn't set the lgname parameter',
			'Illegal' => ' You provided an illegal username',
			'NotExists' => ' The username you provided doesn't exist',
			'EmptyPass' => ' You didn't set the lgpassword parameter or you left it empty',
			'WrongPass' => ' The password you provided is incorrect',
			'WrongPluginPass' => 'Same as `WrongPass", returned when an authentication plugin rather than MediaWiki itself rejected the password',
			'CreateBlocked' => 'The wiki tried to automatically create a new account for you, but your IP address has been blocked from account creation',
			'Throttled' => 'You've logged in too many times in a short time',
			'Blocked' => 'User is blocked',
			'mustbeposted' => 'The login module requires a POST request'
		);

}

r62282 is the start of an implementation for this..

ApiBlock partially done...

Ok, this bug is "implemented"..

The ApiBase is setup, and just needs expanding out further to document the rest of the modules

Nice range of revisions between r62282 and r62415

Thats done most of the work...

ApiBase.php
array( 'code' => 'invalidparammix', 'info' => 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together' ),
array( 'code' => 'missingparam', 'info' => 'One of the parameters ' . implode( ', ', array_shift( func_get_args() ) ) . ' is required' ),
array( 'code' => 'badtimestamp_{$encParamName}', 'info' => "Invalid value '$value' for timestamp parameter $encParamName" ),
array( 'code' => 'baduser_{$encParamName}', 'info' => "Invalid value for user parameter $encParamName" ),
array( 'code' => 'multival_$valueName', 'info' => "Only one $possibleValues is allowed for parameter '$valueName'" ),
array( 'code' => 'unknown_$valueName', 'info' => "Unrecognized value for parameter '$valueName': {$valuesList[0]}" ),

Are still to be done

And, this is only the "top level" stuff.. Not anything (bar the login module...)

Did show there are seemingly quite a few duplicated messages that should be removed and put into the message map.... (Another TODO)

This is done in at least the core (ie used by WMF) extensions too...

So bar actually drilling into sub modules to list their errors, this is all but done..

Resolving as fixed. Should be enough information there now, still, any other modules that may propagate errors up won't be included, but we'll be there for ever

If you need anything extra specifically documentating, just open a new bug and we can do it on a case by case basis