User Tools

Site Tools


syntax:functions:error

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

syntax:functions:error [2017/12/23 09:53] – created dmitrysyntax:functions:error [2021/09/13 20:35] (current) craigt
Line 1: Line 1:
-===== error(text) =====+====== Error(error_text) =====
 +Category:  Special function
  
-Creates an error value with the given //text//.+\\  
 +=====Description===== 
 +This function creates an error value with the given //error_text//.
  
-^  Example  ^  Result  ^ +\\  
-error( 'Something went wrong' )  | #Something went wrong  |+=====Use cases===== 
 +Use this function to raise an error when a known situation occurs that could cause issues downstream, and should not be permitted to continue.  i.e., empty datasets, values outside expected parameters, etc.
  
-See also +\\  
-  * [[syntax:types|Type system]]+=====Arguments===== 
 +^Argument^Type^Description^ 
 +|error_text|Text|The text message shown when the error is displayed.| 
 + 
 +**Return value type:** Error/Text 
 + 
 + 
 +\\  
 +=====Examples===== 
 + 
 +  error('Something went wrong' //Returns '#Something went wrong' 
 + 
 +  error('Dataset is empty' //Returns '#Dataset is empty' 
 + 
 +  if([Value] >= 10, [Value], error('Minimum value is 10') )  //Returns the error if [Value] is below 10. 
 + 
 +\\  
 +=====See also===== 
 +  * [[syntax:functions:iferror|IfError(expression1, expression2)]] 
 +  * [[syntax:functions:iserror|IsError(expression)]] 
 +  * [[syntax:types|The EasyMorph Type system]]
  
syntax/functions/error.txt · Last modified: 2021/09/13 20:35 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki