Minecraft Wiki

The Minecraft Wiki is no longer considered as official by Microsoft and therefore several changes are required to be made, including to the wiki's logo. Please read this announcement for more information.

READ MORE

Minecraft Wiki
m (update doc style)
m (we do not need a "message parameter, as we are not wikipedia requiring tons of alias parameters. I also set the default error to blank, allowing the user to simply call {{error}} without a displayed error, for the sake of #iferror without)
 
Line 4: Line 4:
 
|div=div
 
|div=div
 
|#default=strong
 
|#default=strong
}} class="error">{{{message|{{{1}}}}}}</{{#switch:{{lc:{{{tag}}}}}
+
}} class="error">{{{1<includeonly>|</includeonly>}}}</{{#switch:{{lc:{{{tag}}}}}
 
|p=p
 
|p=p
 
|span=span
 
|span=span

Latest revision as of 17:13, 16 February 2015

{{{1}}}

[view | edit | history | purge]Documentation


The template returns a state of error, and optionally an error-message text in red (visible for the user).

Usage

The parameter |1= can be set to the error to display when using this template.

  • {{error|An exemplary error}}An exemplary error
  • Compare, used in a Parser Function: {{#expr:Foo}}Expression error: Unrecognized word "foo".

If |1= is unset, no error will be displayed, although it still can be detected by {{#iferror:}}

#iferror

The error displayed is detected by the parser function {{#iferror:}}.

  • {{#iferror: {{error|Foo}} | {{c|yes}} | {{c|no}} }} Yes
  • {{#iferror: {{error}} | {{c|yes}} | {{c|no}} }} Yes

Tag option

The tag to contain the error message can be given through the |tag= parameter, but it will only accept span, div, p, and strong, since those are the only tags recognized by the {{#iferror:}} parser function. It defaults to strong, the tag generated by most parsers, e.g. by {{#expr:}}.

Code Result
ABC {{error|An exemplary error demo no tag (default)}} XYZ ABC An exemplary error demo no tag (default) XYZ
ABC {{error|An exemplary error demo span|tag=span}} XYZ ABC An exemplary error demo span XYZ
ABC {{error|An exemplary error demo div|tag=div}} XYZ ABC
An exemplary error demo div
XYZ
ABC {{error|An exemplary error demo p|tag=p}} XYZ ABC

An exemplary error demo p

XYZ
ABC {{error|An exemplary error demo strong|tag=strong}} XYZ ABC An exemplary error demo strong XYZ

See also

[view | edit | history | purge]The above documentation is transcluded from Template:Error/doc.