LassoScript Utility
Basics Browse Detail

[Fail_If]

Tag Link [Fail_If] Category Error
Type Process Source Available No
Support Preferred Version 5.0
Change Unchanged Data Source Any
Output Type None Security None
Implementation Internal Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0

Description

[Fail_If] conditionally halts execution of the current page or [Protect] ... [/Protect] block. Takes three parameters: a conditional expression, an integer error code, and a string error message.

Syntax

[Fail_IfConditional Expression,
  Error Code, 'Error Message']

Parameters

Required Parameters
Conditional Expression If true, then the error code and message will be set, otherwise this tag does nothing.
Error Code The error code to return.
Error Message The error message to return.

Examples

To conditionally report a fatal error:

Use the [Fail_If] tag. Lasso will immediately halt processing of the current page or [Protect] ... [/Protect] block and report the error to the user or run any [Handle] ... [/Handle] tags that are present.

The following code will report an unknown error if the [Action_Param] named 'Required' is empty.

[Fail_If: (Action_Param: 'Required') == ' ', -1, 'Unknown Error']