Keyword

Raise


Description

The Raise statement is used to Raise an exception to the next level in the calling chain.

Usage

Raise expression

Expression must evaluate to an object that is a subclass of RuntimeException — and will be the object that is 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

All project types on all supported operating systems.

See also

Function statement; RuntimeException class; Exception, Try statements.