Lasso Soft Inc. > Home

[ Fail_If ]

Method

[Fail_If] conditionally halts execution of the current page or [Protect] block.

Takes three parameters: a conditional expression, an optional integer error code, and a string error message.

  • Syntax
Fail_If(Conditional Expression,Error Code, 'Error Message')
Fail_If(Conditional Expression, 'Error Message')
Examples
  • Beginner

To conditionally report a fatal error:

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

The following code will report an unknown error if the [web_request->param] named 'Required' is empty.

Note: [Action_Param] is a compatibility layer wrapper for [web_request->param]

Code

Fail_If(not string(web_request->param('Required'))->size, -1, 'Unknown Error')

Result

FAILURE: -1 Unknown Error

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft