Skip to content

Commit 284ca93

Browse files
sep2TheAngryByrd
authored andcommitted
add zipError to AsyncResult/TaskResult/JobResult
1 parent 4c93aa7 commit 284ca93

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/FsToolkit.ErrorHandling.JobResult/JobResult.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ module JobResult =
148148
let zip j1 j2 =
149149
Job.zip j1 j2
150150
|> Job.map(fun (r1, r2) -> Result.zip r1 r2)
151+
152+
/// Takes two results and returns a tuple of the error pair
153+
let zipError j1 j2 =
154+
Job.zip j1 j2
155+
|> Job.map(fun (r1, r2) -> Result.zipError r1 r2)
151156

152157
/// Catches exceptions and maps them to the Error case using the provided function.
153158
let catch f x =

src/FsToolkit.ErrorHandling.TaskResult/TaskResult.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ module TaskResult =
143143
Task.zip x1 x2
144144
|> Task.map(fun (r1, r2) -> Result.zip r1 r2)
145145

146+
/// Takes two results and returns a tuple of the error pair
147+
let zipError x1 x2 =
148+
Task.zip x1 x2
149+
|> Task.map(fun (r1, r2) -> Result.zipError r1 r2)
150+
146151
/// Catches exceptions and maps them to the Error case using the provided function.
147152
let catch f x =
148153
x

src/FsToolkit.ErrorHandling/AsyncResult.fs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ module AsyncResult =
153153
Async.zip x1 x2
154154
|> Async.map(fun (r1, r2) -> Result.zip r1 r2)
155155

156+
/// Takes two results and returns a tuple of the error pair
157+
let zipError x1 x2 =
158+
Async.zip x1 x2
159+
|> Async.map(fun (r1, r2) -> Result.zipError r1 r2)
160+
156161
/// Catches exceptions and maps them to the Error case using the provided function.
157162
let catch f x =
158163
x

0 commit comments

Comments
 (0)