# Chalk SQL Reference: Control Flow and Error Handling
source: https://docs.chalk.ai/chalksql-docs#section-control-flow-and-error-handling

## `fail(message)`
source: https://docs.chalk.ai/chalksql-docs#fail

Raises an error with the specified error `message`.

**Overloads**

#### `fail(message)`

**Parameters**

- `message`: `string`

#### `fail(message)`

**Parameters**

- `message`: `large_string`

## `recover(x, y)`
source: https://docs.chalk.ai/chalksql-docs#recover

Alias for [coalesce](https://docs.chalk.ai/chalksql-docs#coalesce).

## `try_(value)`
source: https://docs.chalk.ai/chalksql-docs#try_

Attempts to execute an expression and handles any errors gracefully.

**Type parameters.** `T` means matching inputs and outputs use the same type.

**Parameters**

- `value`: `$T`
  The input `value`. `T` means matching inputs and outputs use the same type.

## `with_policies(call)`
source: https://docs.chalk.ai/chalksql-docs#with_policies

Wraps a blocking function `call` with execution policies and catalog invocation options.

**Type parameters.** `T` means matching inputs and outputs use the same type.

**Parameters**

- `call`: `$T`
  `T` means matching inputs and outputs use the same type.
- `retry`: `struct<max_retries: int64, key: string, initial_backoff_ms: int64, backoff_multiplier: double, max_backoff_ms: int64, ready_retry_timeout_ms: int64>` = `NULL`
- `rate_limit`: `struct<rate: int64, key: string, per: string, enforce_globally: bool>` = `NULL`
- `concurrency`: `struct<max_concurrent: int64, key: string, enforce_globally: bool>` = `NULL`
- `logging`: `struct<level: string, log_args: bool, key: string>` = `NULL`
- `cache`: `struct<key: string, ttl_seconds: int64, path: string>` = `NULL`
- `batch_size`: `struct<rows_per_call: int64>` = `NULL`
- `asynchronous`: `bool` = `NULL`
- `timeout`: `$Timeout` = `NULL`
- `on_error`: `string` = `NULL`
- `metadata`: `$Metadata` = `NULL`
- `row_metadata`: `$RowMetadata` = `NULL`

**Examples**

```sql
SELECT with_policies(functions.fetch_url(url => release_url), timeout => 30, retry => {'max_retries': 3, 'key': 'fetch_url'}) FROM releases;
```
