dev

Error is a template that outputs an HTML element with class "error" containing an error message. It can be used in other templates to signal errors, e.g. when receiving invalid arguments.

The parser function #iferror recognizes the output of this template as an error, because the output has the same format as errors produced by parser functions such as #expr or #invoke.

Usage

The template should be called with an error message. The message can be assigned to the first unnamed parameter or to the named parameter message.

By default, the template will wrap the message in strong tags. A different tag can be selected by setting the named parameter tag. Accepted values are div, p, span and strong.

The primary use case of the error template is to transclude it in other templates in case an error should be displayed to the user. For example, the following template "greet" creates a greeting message. It has one parameter name and uses the error template if that parameter is not set.

{{#if: {{{name|}}} | Hi there, {{{name}}}! | {{error|No name provided}} }}

TemplateData

Formats error messages as HTML.

Template parameters

ParameterDescriptionTypeStatus
Message1 message

The error message to be displayed.

Contentrequired
Tagtag

The HTML tag for wrapping the error message.

Suggested values
div p span strong
Default
strong
Stringoptional