> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor/ks.reactor.ksexceptionhandler.md).

# Class ksExceptionHandler

Namespace: [KS.Reactor](/reactor/api-reference/ks.reactor.md)\
Assembly: KSCommon.dll

Exception handlers.

```csharp
public static class ksExceptionHandler
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← [ksExceptionHandler](/reactor/api-reference/ks.reactor/ks.reactor.ksexceptionhandler.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Fields

### RethrowExceptions <a href="#ks_reactor_ksexceptionhandler_rethrowexceptions" id="ks_reactor_ksexceptionhandler_rethrowexceptions"></a>

By default don't rethrow exceptions in Unity

```csharp
public static bool RethrowExceptions
```

#### Field Value

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

## Methods

### Handle(string, Exception) <a href="#ks_reactor_ksexceptionhandler_handle_system_string_system_exception" id="ks_reactor_ksexceptionhandler_handle_system_string_system_exception"></a>

Handle an exception by invoking the OnException event. Logs the exception if no event handlers are registered. Marks the exception as handled by adding a KSReactor object to the exception data if rethrowing is enabled.

```csharp
public static void Handle(string message, Exception ex)
```

#### Parameters

`message` [string](https://learn.microsoft.com/dotnet/api/system.string)

Message.

`ex` [Exception](https://learn.microsoft.com/dotnet/api/system.exception)

Exceptions.

### OnException <a href="#ks_reactor_ksexceptionhandler_onexception" id="ks_reactor_ksexceptionhandler_onexception"></a>

Invoked when a exception is caught in developer code.

```csharp
public static event ksExceptionHandler.ExceptionHandler OnException
```

#### Event Type

[ksExceptionHandler](/reactor/api-reference/ks.reactor/ks.reactor.ksexceptionhandler.md).[ExceptionHandler](/reactor/api-reference/ks.reactor/ks.reactor.ksexceptionhandler/ks.reactor.ksexceptionhandler.exceptionhandler.md)
