# getOrReraise

### AsyncResult.getOrReraise

Namespace: `FsToolkit.ErrorHandling`

Unwraps the `Ok` value from an async result. If the result is `Error`, the contained exception is re-raised, preserving the original stack trace (on .NET; on Fable it is raised directly).

This function is only applicable when the error type is `exn`.

### Function Signature:

```fsharp
Async<Result<'ok, exn>> -> Async<'ok>
```

### Examples

#### Example 1

Unwrapping a successful result:

```fsharp
let result : Async<int> =
  AsyncResult.ok 42
  |> AsyncResult.getOrReraise
// evaluates to 42
```

#### Example 2

Re-raising an exception from a failing async computation:

```fsharp
let value : Async<string> =
  AsyncResult.ofTask (System.Threading.Tasks.Task.FromException<string>(System.Exception("oops")))
  |> AsyncResult.getOrReraise
// raises System.Exception "oops"
```

#### Example 3

Using `catch` together with `getOrReraise` to control which exceptions become errors:

```fsharp
let run () : Async<int> =
  riskyOperation ()
  |> AsyncResult.catch id
  |> AsyncResult.getOrReraise
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://demystifyfp.gitbook.io/fstoolkit-errorhandling/fstoolkit.errorhandling/asyncresult/getorreraise.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
