# ThrottleException

Kind: Class · Namespace: Sansar.Script · Assembly: Sansar.Script.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Script">Namespace <a href="/scripting/api/sansar.script"><code>Sansar.Script</code></a></span>
<span>Inherits <a href="https://learn.microsoft.com/dotnet/api/system.exception">Exception</a></span>
</div>

<span id="T:Sansar.Script.ThrottleException"></span>

Thrown when a method is called too often

```csharp
public class ThrottleException : Exception
```

## Remarks

The ThrottleException class has information about the throttle rate and how fast the throttle was hit. This exception is thrown before any action is taken by the method.

## Members at a glance

| Kind | Members |
|---|---|
| **Fields** | [Elapsed](#elapsed) · [Interval](#interval) · [MaxEvents](#maxevents) |

## Fields

### Elapsed

<div class="api-card">
<span id="F:Sansar.Script.ThrottleException.Elapsed"></span>

```csharp signature
public readonly TimeSpan Elapsed
```

The timespan during which [`ThrottleException.MaxEvents`](/scripting/api/sansar.script/throttleexception#maxevents) method calls have happened.

<details class="api-remarks"><summary>Remarks</summary>

Elapsed is a measure of how fast the throttle was hit. All [`ThrottleException.MaxEvents`](/scripting/api/sansar.script/throttleexception#maxevents) have happened within the last Elapsed time span.

</details>

</div>

### Interval

<div class="api-card">
<span id="F:Sansar.Script.ThrottleException.Interval"></span>

```csharp signature
public readonly TimeSpan Interval
```

The timespan during which at most [`ThrottleException.MaxEvents`](/scripting/api/sansar.script/throttleexception#maxevents) can happen without hitting the throttle.

<details class="api-remarks"><summary>Remarks</summary>

[`ThrottleException`](/scripting/api/sansar.script/throttleexception) is thrown if there have already been [`ThrottleException.MaxEvents`](/scripting/api/sansar.script/throttleexception#maxevents) successful calls to this method during the last Interval timespan.

</details>

</div>

### MaxEvents

<div class="api-card">
<span id="F:Sansar.Script.ThrottleException.MaxEvents"></span>

```csharp signature
public readonly int MaxEvents
```

The maximum number of method calls allowed per [`ThrottleException.Interval`](/scripting/api/sansar.script/throttleexception#interval)

<details class="api-remarks"><summary>Remarks</summary>

Method calls past MaxEvents during [`ThrottleException.Interval`](/scripting/api/sansar.script/throttleexception#interval) will throw an exception and not be counted as events.

</details>

</div>


## Used in examples

- [ScriptLibrary/Scene/AudioStream.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Scene/AudioStream.cs)
- [ScriptLibrary/Scene/Dispenser.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Scene/Dispenser.cs)
- [ScriptLibrary/Scene/Media.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Scene/Media.cs)

<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>