{error}
Sample Usage
{if: catch(count <= 0, yes)}{error: The count is not greater than 0!; block=yes}{endif}
Quick Overview VideoSettings
Setting Name Type Description Positional text The error message to show to the user. block yes/no If yes
, blocks insertion while the error is shown. show default/validate validate
will show the error only after you attempt to insert the snippet.General Command Settings trim yes/no/left/right If yes
whitespace is removed before and after the command. If left
, only whitespace to the left is removed. If right
, only whitespace to the right is removed.
Setting Name | Type | Description |
---|---|---|
Positional | text | The error message to show to the user. |
block | yes/no | If yes , blocks insertion while the error is shown. |
show | default/validate | validate will show the error only after you attempt to insert the snippet. |
General Command Settings | ||
trim | yes/no/left/right | If yes whitespace is removed before and after the command. If left , only whitespace to the left is removed. If right , only whitespace to the right is removed. |
The error
command can be used for form validation and for preventing a snippet from being inserted until certain conditions are met.
The error
command is best used in combination with the {if} command to conditionally show an error and block snippet insertion.
The block
setting
If the block
setting is no
the message that you used in the first positional setting will be inserted into your snippet.
Notice how the error text is inserted into the snippet itself inside of the [Error - ]
text.
If block
is yes
, the message will be displayed (not inserted) and the snippet user will not be able to insert the snippet until the error is resolved.
Text Blaze will not allow you to insert the snippet by showing an alert.
Error checking your team's snippets
A good use case for the error
command is when you're sharing snippets with your team. It will ensure that everyone using the snippet is entering the right information and validating it correctly before the final insertion.