Fandom Developers Wiki

Error is a global Lua module used for implementing the Error template. It is a copy of Wikipedia's Error module.

Installation[]

Usage[]


Invoking the error function renders an HTML element with class "error" containing the error message passed as the first argument.

{{#invoke:Error|error|I am Error}}I am Error

The output has the same format as the errors produced by parser functions such as #expr or #invoke. Therefore, the parser function #iferror will recognize the output as an error.

{{#iferror: {{#invoke:Error|error|I am Error}}
| Yeah, this is an error.
| Nope, this is something else.
}}


Yeah, this is an error.

By default, the error function wraps the message in strong tags. The named parameter tag can be used to specify another tag. Accepted values are p, div, span and strong, since those are the only values recognized by the #iferror parser function.

{{#invoke:Error|error|I am Error|tag=span}}I am Error

API[]

Package items[]

Error.error(frame) (function)
Entrypoint for Template:Error.
Parameter: frame The Scribunto frame object. (table)
Returns: An HTML object with class "error". (string)