throwExceptions()
Configure GGC to stop if action fails.
Syntax
throwExceptions(
te BOOLEAN )
- te is the status of the exceptions, whether enabled (
TRUE
) or disabled (FALSE
).
Usage
Use it to temporarily disable and re-enable exception management in a scenario execution. For
instance, if you know a call to trigger an action is expected to stop the scenario with a scenario
failure, you can use the function to disable the error (CALL
ggc.throwExceptions(FALSE)
) before calling the action. After calling the action, you
restore exception management with CALL ggc.throwExceptions(TRUE)
.
In the example, the action "It_will_fail" does not exist and should cause the scenario to fail. The test runs successfully because exceptions are disabled. Checking the status expected after the call to the action allows you to display the status message. You should see something like "The action 'it_will_fail' does not belong to the active dialog." in the output.
# Turn off exceptions, errors will not be raised till restored
CALL ggc.throwExceptions(FALSE)
# This action does not exist
CALL ggc.action("It_will_fail")
# Check the status of the last action, and display the status message
IF ggc.statusCode IN (ggc.ACTION_NOT_FOUND, ggc.ACTION_NOT_ACTIVE) THEN
DISPLAY ggc.statusMsg
END IF
# Restore exceptions, errors will be raised again
CALL ggc.throwExceptions(TRUE)