@@ -7,27 +7,27 @@ module Async =
77 let map f m = async.Bind( m, ( f >> async.Return))
88
99 let awaitTaskWithInnerException ( task : Task < 'T >): Async < 'T > =
10- Async.FromContinuations( fun ( suc , exn , _cln ) ->
10+ Async.FromContinuations( fun ( success , exception' , _cancellationToken ) ->
1111 task.ContinueWith( fun ( t : Task < 'T >) ->
12- if t.IsFaulted
13- then if t.Exception.InnerExceptions.Count = 1 then
14- exn t.Exception.InnerExceptions.[ 0 ]
15- else
16- exn t.Exception
17- elif t.IsCanceled
18- then exn ( TaskCanceledException ())
19- else suc t.Result)
12+ if t.IsFaulted then
13+ if t.Exception.InnerExceptions.Count = 1
14+ then exception' t.Exception.InnerExceptions.[ 0 ]
15+ else exception' t.Exception
16+ elif t.IsCanceled then
17+ exception' ( TaskCanceledException ())
18+ else
19+ success t.Result)
2020 |> ignore)
2121
2222 let awaitTaskWithInnerException ' ( task : Task ): Async < unit > =
23- Async.FromContinuations( fun ( suc , exn , _cln ) ->
23+ Async.FromContinuations( fun ( success , exception' , _cancellationToken ) ->
2424 task.ContinueWith( fun ( t : Task ) ->
25- if t.IsFaulted
26- then if t.Exception.InnerExceptions.Count = 1 then
27- exn t.Exception.InnerExceptions.[ 0 ]
28- else
29- exn t.Exception
30- elif t.IsCanceled
31- then exn ( TaskCanceledException ())
32- else suc ())
25+ if t.IsFaulted then
26+ if t.Exception.InnerExceptions.Count = 1
27+ then exception' t.Exception.InnerExceptions.[ 0 ]
28+ else exception' t.Exception
29+ elif t.IsCanceled then
30+ exception' ( TaskCanceledException ())
31+ else
32+ success ())
3333 |> ignore)
0 commit comments