Statements: throw
The throw statement raises a runtime exception.
Syntax
throwexpression;
Discussion
The throw statement aborts the current execution and transfers the control to the error handler (a panic function within the Runtime Environment). Exceptions are considered as non-recoverable fatal errors. If an exception is thrown, the program execution can't continue. As such, you use the throw statement in very particular situations, where your application encounters an error and there is no way to recover the situation.
The expression in the throw statement must result in data type string. This expression should describe the cause of the error. It is passed in a parameter to the Runtime Environment panic function. For example:
var SomeUnit::DriverClass driver = SomeUnit::DriverObject; // Try to initialize an important subsystem if ( !driver.InitializeEngineInterface()) throw "ENGINE NOT CONNECTED!";