> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> This function can be used for the purpose of testing exception safety. It will throw an exception on creation with the specified probability.

# aggThrow

<h2 id="aggThrow">
  aggThrow
</h2>

Introduced in: v20.1.0

This function can be used for the purpose of testing exception safety. It will throw an exception on creation with the specified probability.

**Syntax**

```sql theme={null}
aggThrow(throw_prob)
```

**Arguments**

* `throw_prob` — Probability to throw on creation. [`Float64`](/reference/data-types/float)

**Returned value**

Returns an exception: `Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully`.

**Examples**

**Usage example**

```sql title=Query theme={null}
SELECT number % 2 AS even, aggThrow(number) FROM numbers(10) GROUP BY even;
```

```response title=Response theme={null}
Received exception:
Code: 503. DB::Exception: Aggregate function aggThrow has thrown exception successfully: While executing AggregatingTransform. (AGGREGATE_FUNCTION_THROW)
```
