We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a14dc57 commit 475bda2Copy full SHA for 475bda2
src/ExceptionsHandler.fs
@@ -1,9 +1,10 @@
1
namespace SqlStreamStore.FSharp
2
3
module ExceptionsHandler =
4
- let asyncExceptionHandler (op: Async<'suc>): Async<Result<'suc, string>> =
5
- op
+ /// Handles thrown exceptions from an async operation by wrapping them in a Result.
+ let asyncExceptionHandler (asyncOperation: Async<'a>): Async<Result<'a, exn>> =
6
+ asyncOperation
7
|> Async.Catch
8
|> Async.map (function
9
| Choice1Of2 response -> Ok response
- | Choice2Of2 exn -> Error exn.Message)
10
+ | Choice2Of2 exn -> Error exn)
0 commit comments