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:
Async<Result<'ok, exn>> -> Async<'ok>Examples
Example 1
Unwrapping a successful result:
let result : Async<int> =
AsyncResult.ok 42
|> AsyncResult.getOrReraise
// evaluates to 42Example 2
Re-raising an exception from a failing async computation:
Example 3
Using catch together with getOrReraise to control which exceptions become errors:
Last updated