errset
errset(g_expr[g_errprint] ) =>l_result/nil
Description
Encapsulates the execution of an expression in an environment safe from the error mechanism. This is a syntax form.
If an error occurs in the evaluation of the given expression, control always returns to the command following the errset instead of returning to the nearest toplevel. If g_errprint is non-nil, error messages are issued; otherwise they are suppressed. In either case, information about the error is placed in the errset property of the errset symbol. Programs can therefore access this information with the errset.errset construct after determining that errset returned nil.
Arguments
Value Returned
Examples
errset(1+2)
=> (3)
errset.errset
=> nil
errset(sqrt('x))
=> nil
Because sqrt requires a numerical argument.
errset.errset
=> ("sqrt" 0 t nil ("*Error* sqrt: can't handle sqrt(x)...))
When working in the CIW, to ensure that the errset.errset variable is not modified internally in the Virtuoso Studio design environment, do not separate errset and errset.errset. For example, use this construct:
errset(sqrt('x)), errset.errset
=> ("sqrt" 0 t nil ("*Error* sqrt: cannot handle sqrt(x)"))
Related Topics
Function and Program Structure
Return to top