THROW
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
THROW [object_handle]
Arguments
object_handle
(optional) An object handle derived from System.Exception.
Discussion
The THROW statement unwinds the stack automatically until a handler that handles the type of exception thrown is located. This allows errors that occur deep within a series of routine calls to be handled at a higher level by a single exception handler.
The THROW statement adds a line of the format
" at namespace.class.member in filename:line line_num"
to the StackTrace property of the exception for each nested level on the unwind stack. The topmost line indicates the line where the THROW occurred.
You can rethrow the most recently caught exception and maintain the exception’s original context by using the THROW command within your CATCH block without specifying object. You cannot rethrow outside of a CATCH block.
For example, the following will rethrow the caught exception:
catch (e, @Exception) begin throw end
See also
Examples
The example below throws the object returned by “new Exception(“My Error”)”.
throw new Exception("My Error")