ETHROW Statement
The DataBasic ETHROW statement is used to generate a user exception. ETHROW transfers control to the label most recently identified by an ECATCH statement which may have occurred in calling code higher up the return stack
Syntax
ETHROW n {, exception message}
Syntax Elements
n |
The non-zero exception number. The allowed range of user exception numbers is 1 – 9999. If the specified number is outside this range, a fatal runtime error B66 will occur. (System generated exceptions use numbers above 9999.) |
exception message |
An optional string containing the exception message. It can be multi-valued. |
Operation
On execution of the ETHROW statement, control will be transferred to the label most recently identified by an ECATCH statement, which may have occurred in calling code earlier in the call stack.
If no exception catch label has been defined within this or an earlier code level, a fatal runtime error B64 will occur.
A valid ETHROW statement, when used with a defined catch label, will save the specified exception number and optional exception message for use by the EXCEPT.NUM() and EXCEPT.MSG() functions. In addition, the system will also save the current location and code level return stack information for use by the EXCEPT.STK() function.
Any subsequent exceptions will overwrite the saved exception information before transferring control to any active exception catch labels defined at this or earlier code levels.