The Raise Statement

Syntax

$ RaiseStatement = RAISE [ Ident ] ";"

Description

The Raise statement is used to throw an exception. After the Raise keyword the reference to the object must be specified, the object must contain error information. The basic assembly contains the Exception system class, which contains functionality of this object.

The Raise statement can also be used in the Try statement exceptions processing block to pass the occurred exception into the enclosing block. In this case it can be used without specifying a link to the object.

Example

Sub Main;

Begin

Try

Raise New Exception.Create("Exception");

Except On E: Exception Do

Debug.WriteLine("The except block. The message text: ");

Debug.WriteLine(e.Message);

End Try;

End Sub Main;

After executing the example an exception is thrown. When handling an exception the development environment console displays error message text.

See also:

Statements

Handling Exceptions

Try … Except … Finally … End Try