errorTrap

 

 

Description

The errorTrap function evaluates the first expression. If an Error value results, the second expression is evaluated. The Error value is trapped by the function instead of returning to the top level console as would occur if an error function was used.

When to use

The errorTrap function is used if you didn't want to exit to the top level console if an error occurred. One could therefore trap the error and performed some other action once the error is trapped.

 

Syntax

(errorTrap exp1 exp2)



Name Description AIS Types
exp1 The expression to be evaluated.---
exp2 The expression to be evaluated if an error occurred.---


Returns:

The result of expr1 (if no error).

 

Examples

Here are a number of links to Lambda coding examples which contain this instruction in various use cases.

Example_Error_errorTrap_001

The errorTrap function exits the current function and prints the output, 3, once the error is trapped.

 

Argument Types

Here are the links to the data types of the function arguments.

Error

Here are also a number of links to functions having arguments with any of these data types.

errorTrap(Error) error(Error) isIdentical(BitVector) isIdentical(Boolean)
isIdentical(Brick) isIdentical(Character) isIdentical(Complex) isIdentical(Date)
isIdentical(Dictionary) isIdentical(Directory) isIdentical(Error) isIdentical(FltVector)
isIdentical(Function) isIdentical(IntVector) isIdentical(List) isIdentical(Matrix)
isIdentical(NumMatrix) isIdentical(NumVector) isIdentical(Number) isIdentical(ObjVector)
isIdentical(ObjectRepository) isIdentical(Pair) isIdentical(PcodeVector) isIdentical(ShortVector)
isIdentical(Structure) isIdentical(Vector) isIdentical(Void) string(Complex)
string(String)

How do I contact the AIS team?

You can always talk with the AIS at aiserver.sourceforge.net.