API:Errors and warnings/es

Si algo sale mal en uan solicitud a la API, un error o advertencia aparecerá (aunque la respuesta HTTP usualmente seguirá siendo ). Las advertencias aparecen con condiciones no fatales, como parámetros no válidos, mientras que los errores solo aparecen con condiciones fatales.

Advertencia
Las advertencias se agrupan por el nombre del módulo que las causa. Múltiples advertencias del mismo módulo están separadas por una nueva línea. En el modo de formato de error heredado (ver a continuación), que es el predeterminado, las advertencias se emiten en el siguiente formato:

( será reemplazado por   cuando se use  .)

Cuando se utiliza una opción de formato de error no heredada, las advertencias se generan en el mismo formato que los errores. Por ejemplo con el formato será: ( will be replaced with   when    is used.)



Error formats
Since MediaWiki 1.29 errors are localizable, and available in multiple formats. An error (or warning) is expected to consist of a message, an error code (an arbitrary string, usually generated from the message key; see also below), and optional extra data (an associative array). An API response with errors will look like this:

The  key in the output above will be missing if there is no extra data to display.

The way the error message in the output above is returned to the client is controlled by the  API parameter. The various error formats available are:

For the formatting modes which involve message lookup (,  and  ) the API parameter   can be used to set the language (only needed when different from the content language) and   to set whether the MediaWiki: namespace can be used to override default error messages.

Error codes are also returned in the  response HTTP header, separated by commas when there are multiple errors.

For an example error response or to test your client's error handling, visit https://en.wikipedia.org/w/api.php?action=blah&errorformat=plaintext&format=jsonfm&formatversion=2

When  is not set (or set to  ), errors will be displayed in the legacy format instead.

Legacy format
In the legacy error format, there is always at most one error; additional ones are discarded. The response looks like this:

The extra data in the output above is spliced into the object instead of being under the  key.

Error messages in documentation
Error messages are documented in this wiki as shown below, which corresponds to the json error response in above:

The various error messages are:

Standard error messages
Some generic error messages are shared among modules. If a module can throw these errors, that's explicitly mentioned in its  section.

Additional notes

 * All error and warning outputs above use . For , the field   will be replaced by.