Raise

From Xojo Documentation

Language Keyword

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

See Also

Function statement; RuntimeException class; Exception, Try statements.