Skip to content

Commit 475bda2

Browse files
author
Jamil Maqdis Anton
committed
Add docs. Change exception type.
1 parent a14dc57 commit 475bda2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ExceptionsHandler.fs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
namespace SqlStreamStore.FSharp
22

33
module ExceptionsHandler =
4-
let asyncExceptionHandler (op: Async<'suc>): Async<Result<'suc, string>> =
5-
op
4+
/// Handles thrown exceptions from an async operation by wrapping them in a Result.
5+
let asyncExceptionHandler (asyncOperation: Async<'a>): Async<Result<'a, exn>> =
6+
asyncOperation
67
|> Async.Catch
78
|> Async.map (function
89
| Choice1Of2 response -> Ok response
9-
| Choice2Of2 exn -> Error exn.Message)
10+
| Choice2Of2 exn -> Error exn)

0 commit comments

Comments
 (0)