<div class="meta" robots="noindex">

</div>

Class

# ErrorException

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2021r2 without replacement.

</div>

## Description

Represents an exception that is not necessarily caused by programmer error but rather something from the OS. A good example is trying to write to a read-only file. Checking the writability in advance introduces a 'time of check to time of use' race condition, so the correct thing actually is to just open it.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                              | Type                                                 | Read-Only | Shared |
|---------------------------------------------------|------------------------------------------------------|-----------|--------|
| `ErrorDomain<errorexception.errordomain>`         | `Text</api/deprecated/text>`                         | ✓         |        |
| `ErrorNumber<errorexception.errornumber>`         | `Integer</api/data_types/integer>`                   |           |        |
| `Handle<errorexception.handle>`                   | `Ptr</api/data_types/additional_types/ptr>`          | ✓         |        |
| `LocalizedReason<errorexception.localizedreason>` | `Text</api/deprecated/text>`                         | ✓         |        |
| `Message<errorexception.message>`                 | `String</api/data_types/string>`                     |           |        |
| `UnderlyingError<errorexception.underlyingerror>` | `RuntimeException</api/exceptions/runtimeexception>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                       | Parameters                                                                                            | Returns                                  | Shared |
|--------------------------------------------|-------------------------------------------------------------------------------------------------------|------------------------------------------|--------|
| `Constructor<errorexception.constructor0>` | message As `String</api/data_types/string>` = "", errorCode As `Integer</api/data_types/integer>` = 0 |                                          |        |
| `Stack<errorexception.stack>`              |                                                                                                       | `String</api/data_types/string>`         |        |
| `StackFrames<errorexception.stackframes>`  |                                                                                                       | `StackFrame</api/exceptions/stackframe>` |        |

## Property descriptions

<div id="errorexception.errordomain">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.ErrorDomain

**ErrorDomain** As `Text</api/deprecated/text>`

The error domain for the framework's cross platform error codes, specified using the constants POSIXErrorDomain, WindowsErrorDomain and XojoErrorDomain.

This property is read-only.

<div id="errorexception.errornumber">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.ErrorNumber

**ErrorNumber** As `Integer</api/data_types/integer>`

Used to contain an error number that describes the runtime error.

<div id="errorexception.handle">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

If this exception was created from an NSError on iOS or macOS, this provides access to the NSError.

This property is read-only.

<div id="errorexception.localizedreason">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.LocalizedReason

**LocalizedReason** As `Text</api/deprecated/text>`

When available, a localized and user-presentable error message. If no suitable localized message is known, this will be empty.

This property is read-only.

<div id="errorexception.message">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.Message

**Message** As `String</api/data_types/string>`

Used to contain descriptive text to display when the runtime exception is encountered.

<div id="errorexception.underlyingerror">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.UnderlyingError

**UnderlyingError** As `RuntimeException</api/exceptions/runtimeexception>`

The lower level error, if any that triggered this error.

This property is read-only.

## Method descriptions

<div id="errorexception.constructor0">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.Constructor

**Constructor**(message As `String</api/data_types/string>` = "", errorCode As `Integer</api/data_types/integer>` = 0)

<div class="note">

<div class="title">

Note

</div>

`Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.

</div>

Used to raise your own `RuntimeException</api/exceptions/runtimeexception>` with a message and optional error code.

<div id="errorexception.stack">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.Stack

**Stack** As `String</api/data_types/string>`

Returns a `String</api/data_types/string>` array that contains a list of all of the methods in the stack from the main entrypoint to the point at which the exception was invoked.

The stack contains all the method names up and including the current method name.

This feature only works if the **IncludeFunctionNames** property on the App object is selected in the Shared Build Settings.

In addition to your own method calls, you will also see framework method calls, but these may not always be completely accurate due to insufficient symbols for the OS to resolve.

<div id="errorexception.stackframes">

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

</div>

<div class="rst-class">

forsearch

</div>

ErrorException.StackFrames

**StackFrames** As `StackFrame</api/exceptions/stackframe>`

Returns an array containing the stack when the exception was first raised.

## Notes

### Constants

| Name               | Type    | Description                                                                                               |
|--------------------|---------|-----------------------------------------------------------------------------------------------------------|
| POSIXErrorDomain   | POSIX   | The error domain for error codes coming from POSIX functions in the form of errno values (Mac and Linux). |
| WindowsErrorDomain | Windows | The error domain for error codes coming from Windows functions in the form of HRESULT values.             |
| XojoErrorDomain    | Xojo    | The error domain for the framework's cross platform error codes.                                          |

## Compatibility

All project types on all supported operating systems.
