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.



(errorTrap exp1 exp2)

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


The result of expr1 (if no error).



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


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.


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)

How do I contact the AIS team?

You can always talk with the AIS at