Skip to content

Commit e372a6b

Browse files
committed
Fix handling of empty AggregateExn
1 parent 76164c6 commit e372a6b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/FSharpPlus/Extensions/Extensions.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ module Extensions =
132132
computation,
133133
ts.SetResult,
134134
(function
135-
| :? AggregateException as agg -> ts.SetException agg.InnerExceptions
135+
| :? AggregateException as aex ->
136+
let exns = aex.InnerExceptions
137+
if exns.Count = 0 then ts.SetException aex
138+
else ts.SetException exns
136139
| exn -> ts.SetException exn),
137140
(fun _ -> ts.SetCanceled ()),
138141
cancellationToken)

0 commit comments

Comments
 (0)