Error creating thumbnail: File missing Join our Discord! |
If you have been locked out of your account you can request a password reset here. |
Template:Formatting error/doc: Difference between revisions
Zackmann08 (talk | contribs) (Created page with "Outputs an error message in red into the page and adds the page to Category:Pages with incorrect formatting templates use. An anchor (FormattingError) is inserted at the ...") |
No edit summary |
||
Line 8: | Line 8: | ||
This template can be evaluated using the <code>{{#iferror}}</code> parser function: | This template can be evaluated using the <code>{{#iferror}}</code> parser function: | ||
* <code><nowiki>{{#iferror:{{val|XX}}|error|OK}}</nowiki></code> → <code>{{#iferror:{{val|XX}}|error|OK}}</code> | * <code><nowiki>{{#iferror:{{val|XX}}|error|OK}}</nowiki></code> → <code>{{#iferror:{{val|XX}}|error|OK}}</code> | ||
<noinclude>[[Category:Template documentation]] | |||
</noinclude> |
Latest revision as of 19:22, 1 April 2023
Outputs an error message in red into the page and adds the page to Category:Pages with incorrect formatting templates use. An anchor (FormattingError) is inserted at the start of the error message, so you can find any errors on a page easily by adding #FormattingError at the end of the URL. Used in complex templates that check their arguments for validity, so incorrect use can be spotted while editing a page or afterwards.
Usage
- {{FormattingError|error message}}
or
- {{FormattingError|error message|nocategory=true}}
When using the nocategory argument, the error message is displayed as usual, but the page is not added to Category:Pages with incorrect formatting templates use. This is useful in documentation pages for templates that use FormattingError and show what errors they can generate without adding these documentation pages to the category.
This template can be evaluated using the {{#iferror}}
parser function:
{{#iferror:{{val|XX}}|error|OK}}
→OK