---
title: experimental.catch() function
description: experimental.catch() calls a function and returns any error as a string value. If the function does not error the returned value is made into a string and returned.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/catch/
estimated_tokens: 627
product: Flux
version: v0
---

# experimental.catch() function

-   Flux 0.174.0+
-   View InfluxDB support

`experimental.catch()` is [subject to change at any time](/flux/v0/stdlib/experimental/#experimental-packages-are-subject-to-change).

`experimental.catch()` calls a function and returns any error as a string value. If the function does not error the returned value is made into a string and returned.

##### Function type signature

```js
(fn: () => A) => {value: A, msg: string, code: uint}
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### fn

(Required) Function to call.

## Examples

### Catch an explicit error

```js
import "experimental"

experimental.catch(fn: () => die(msg: "error message"))// Returns "error message"

```
