Keyword
Raise
Description
The Raise statement is used to Raise an exception to the next level in the calling chain.
Usage
Raise expression
Part |
Type |
Description |
---|---|---|
expression |
Evaluates to an object that is a subclass of RuntimeException and is the object passed to any exception handlers. |
Notes
You can create your own subclasses of RuntimeException and use Raise to Raise them for error conditions.
Sample code
Manually Raise an OutOfBoundsException:
Raise New OutOfBoundsException
Raise your own RuntimeException subclass. In this code, ParseException is a class added to the project and is a subclass of RuntimeException:
Var e As New ParseException ' subclass of RuntimeException
e.Message = "My error message."
Raise e
Compatibility
Project Types |
All |
Operating Systems |
All |
See also
Function statement; RuntimeException class; Exception, Try statements.