@@ -7,27 +7,27 @@ module Async =
7
7
let map f m = async.Bind( m, ( f >> async.Return))
8
8
9
9
let awaitTaskWithInnerException ( task : Task < 'T >): Async < 'T > =
10
- Async.FromContinuations( fun ( suc , exn , _cln ) ->
10
+ Async.FromContinuations( fun ( success , exception' , _cancellationToken ) ->
11
11
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)
20
20
|> ignore)
21
21
22
22
let awaitTaskWithInnerException ' ( task : Task ): Async < unit > =
23
- Async.FromContinuations( fun ( suc , exn , _cln ) ->
23
+ Async.FromContinuations( fun ( success , exception' , _cancellationToken ) ->
24
24
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 ())
33
33
|> ignore)
0 commit comments