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

catch

catch(
s_tag
g_form
) 
=> g_result

Description

Establishes a control transfer or a return point for the throw and err functions. The return point is identified with a s_tag. So, when a particular tag/exception is caught, catch evaluates g_form. If the forms execute normally (without error), the value of the last body form is returned from the catch. There can also be nested catch blocks and s_tag can be t (the value t the catch function catch any condition thrown by throw).

Arguments

s_tag

Identifies the return point for the throw and err functions

g_form

Specifies the forms that are evaluated

Value Returned

g_result

The value of the last form if the forms exit normally, otherwise, returns the values that are thrown if a throw or err occurs

Examples

The following example describes a nested catch. The tag, 'wrongPlat, is caught by the default handler catch(t . . .).

catch(t
    catch('issue1
     printf("Hello ")
catch('issue2
when(cdsPlat() == "lnx86"
throw('wrongPlat printf("\n") nil); no exception is thrown on non-lnx86 platforms
)
printf("world\n")
)
       )
 )
Hello
=> nil 

Related Topics

Flow Control Functions


Return to top
 ⠀
X