attempt, recover

Syntax

attempt {
    attempt body
}
recover {
    recover body
}

where:

Description

The attempt and recover statements are used together in order to handle cases where errors may occur, and provide alternate processing for this case.

If an error occurs in the attempt block, the recover block is executed. If an error does not occur, the recover block will not be executed.

Examples

attempt {
    return "My name is " + class.myScript;
}
recover {
    return "Oops! the script failed"
}