Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

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

g_expr

Expression to be evaluated; while evaluating it, any errors cause immediate return from the errset.

g_errprint

Flag to control the printout of error messages. If t then prints the error message encountered in errset, defaults to nil.

Value Returned

l_result

List with value from successful evaluation of g_expr.

nil

An error occurred.

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

error


Return to top
 ⠀
X