MediaWiki REL1_40
|
Interface for messages with machine-readable data for use by the API. More...
Inherits MessageSpecifier.
Inherited by ApiMessage, and ApiRawMessage.
Public Member Functions | |
getApiCode () | |
Returns a machine-readable code for use by the API. | |
getApiData () | |
Returns additional machine-readable data about the error condition. | |
setApiCode ( $code, array $data=null) | |
Sets the machine-readable code for use by the API. | |
setApiData (array $data) | |
Sets additional machine-readable data about the error condition. | |
Public Member Functions inherited from MessageSpecifier | |
getKey () | |
Returns the message key. | |
getParams () | |
Returns the message parameters. | |
Interface for messages with machine-readable data for use by the API.
The idea is that it's a Message that has some extra data for the API to use when interpreting it as an error (or, in the future, as a warning). Internals of MediaWiki often use messages (or message keys, or Status objects containing messages) to pass information about errors to the user (see e.g. PermissionManager::getPermissionErrors()) and the API has to make do with that.
Definition at line 39 of file IApiMessage.php.
IApiMessage::getApiCode | ( | ) |
Returns a machine-readable code for use by the API.
If no code was specifically set, the message key is used as the code after removing "apiwarn-" or "apierror-" prefixes and applying backwards-compatibility mappings.
Referenced by MediaWiki\Rest\Handler\ActionModuleBasedHandler\throwHttpExceptionForActionModuleError(), MediaWiki\Rest\Handler\EditHandler\throwHttpExceptionForActionModuleError(), and MediaWiki\Rest\Handler\UpdateHandler\throwHttpExceptionForActionModuleError().
IApiMessage::getApiData | ( | ) |
Returns additional machine-readable data about the error condition.
IApiMessage::setApiCode | ( | $code, | |
array | $data = null ) |
Sets the machine-readable code for use by the API.
string | null | $code | If null, uses the default (see self::getApiCode()) |
array | null | $data | If non-null, passed to self::setApiData() |
Referenced by ApiRawMessage\__construct().
IApiMessage::setApiData | ( | array | $data | ) |
Sets additional machine-readable data about the error condition.
array | $data |