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
Value Returned
|
The value of the last form if the forms exit normally, otherwise, returns the values that are thrown if a |
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
Return to top