From Xojo Documentation

Revision as of 19:22, 9 July 2018 by PLefebvre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Language Keyword

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


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.


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:

Dim e As New ParseException // subclass of RuntimeException
e.Message = "My error message."
Raise e

See Also

Function statement; RuntimeException class; Exception, Try statements.