Keyword

# Raise

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

The <span class="title-ref">Raise</span> statement is used to <span class="title-ref">Raise</span> an exception to the next level in the calling chain.

## Usage

``` xojo
Raise expression
```

| Part       | Type | Description                                                                                                                                           |
|------------|------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| expression |      | Evaluates to an object that is a subclass of `RuntimeException</api/exceptions/runtimeexception>` and is the object passed to any exception handlers. |

## Notes

You can create your own subclasses of RuntimeException and use <span class="title-ref">Raise</span> to <span class="title-ref">Raise</span> them for error conditions.

## Sample code

Manually <span class="title-ref">Raise</span> an OutOfBoundsException:

``` xojo
Raise New OutOfBoundsException
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<span class="title-ref">Raise</span> your own RuntimeException subclass. In this code, ParseException is a class added to the project and is a subclass of RuntimeException:

``` xojo
Var e As New ParseException ' subclass of RuntimeException
e.Message = "My error message."
Raise e
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Function</api/language/function>` statement; `RuntimeException</api/exceptions/runtimeexception>` class; `Exception</api/exceptions/exception>`, `Try</api/language/try>` statements.

</div>
