Skip to content

Commit cc27d40

Browse files
author
Jamil Maqdis Anton
committed
Move AsyncExtras.fs content to ExceptionsHandler.fs
1 parent f0525cc commit cc27d40

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/AsyncExtras.fs

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/ExceptionsHandler.fs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
module ExceptionsHandler
1+
namespace SqlStreamStore.Fsharp
22

3-
let simpleExceptionHandler (op: Async<'res>): Async<Result<'res, string>> =
4-
op
5-
|> Async.Catch
6-
|> Async.map (function
7-
| Choice1Of2 response -> Ok response
8-
| Choice2Of2 exn -> Error exn.Message)
3+
module Async =
4+
let bind f m = async.Bind(m, f)
5+
let map f m = m |> bind (f >> async.Return)
6+
7+
module ExceptionsHandler =
8+
9+
let simpleExceptionHandler (op: Async<'res>): Async<Result<'res, string>> =
10+
op
11+
|> Async.Catch
12+
|> Async.map (function
13+
| Choice1Of2 response -> Ok response
14+
| Choice2Of2 exn -> Error exn.Message)

0 commit comments

Comments
 (0)