Skip to content

Commit 8273e43

Browse files
author
Jamil Maqdis Anton
committed
Handle exceptions thrown by reading and appending
1 parent 090bfd2 commit 8273e43

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ExceptionHandler.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module ExceptionHandler
2+
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)

0 commit comments

Comments
 (0)