Class ErrorFunctions
- java.lang.Object
-
- com.scriptbasic.utility.functions.ErrorFunctions
-
public class ErrorFunctions extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidasserT(java.lang.String s, java.lang.Boolean b)Throw an exception causing BASIC runtime error if the assertion fails.static voiderror(java.lang.String s)Throw an exception causing BASIC runtime error.
-
-
-
Method Detail
-
error
public static void error(java.lang.String s) throws ScriptBasicExceptionThrow an exception causing BASIC runtime error. This method can be called directly from BASIC to stop the interpreter with an error condition.- Parameters:
s- the message in the error- Throws:
ScriptBasicException- always
-
asserT
public static void asserT(java.lang.String s, java.lang.Boolean b) throws ScriptBasicExceptionThrow an exception causing BASIC runtime error if the assertion fails. This can be used in the BASIC program to test preconditions and stop the execution of the BASIC program if the condition fails. For example you can writeassert("test that the parameter starts with the required prefix", startsWith(s,prefix))In the example above if the variable
sstarts with the string contained in the variableprefixthen the execution of the BASIC program goes on, otherwise the function causes BASIC runtime error.- Parameters:
s- parameterb- parameter- Throws:
ScriptBasicException- in case of exception
-
-