@@ -157,8 +157,9 @@ type CancellableBuilder() =
157
157
match Cancellable.run ct comp with
158
158
| ValueOrCancelled.Value res -> ValueOrCancelled.Value( Choice1Of2 res)
159
159
| ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn
160
- with err ->
161
- ValueOrCancelled.Value( Choice2Of2 err)
160
+ with
161
+ | :? OperationCanceledException as exn when ct.IsCancellationRequested -> ValueOrCancelled.Cancelled exn
162
+ | err -> ValueOrCancelled.Value( Choice2Of2 err)
162
163
163
164
match compRes with
164
165
| ValueOrCancelled.Value res ->
@@ -179,8 +180,9 @@ type CancellableBuilder() =
179
180
match Cancellable.run ct body with
180
181
| ValueOrCancelled.Value res -> ValueOrCancelled.Value( Choice1Of2 res)
181
182
| ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn
182
- with err ->
183
- ValueOrCancelled.Value( Choice2Of2 err)
183
+ with
184
+ | :? OperationCanceledException as exn when ct.IsCancellationRequested -> ValueOrCancelled.Cancelled exn
185
+ | err -> ValueOrCancelled.Value( Choice2Of2 err)
184
186
185
187
match compRes with
186
188
| ValueOrCancelled.Value res ->
@@ -201,8 +203,9 @@ type CancellableBuilder() =
201
203
match Cancellable.run ct comp with
202
204
| ValueOrCancelled.Value res -> ValueOrCancelled.Value( Choice1Of2 res)
203
205
| ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn
204
- with err ->
205
- ValueOrCancelled.Value( Choice2Of2 err)
206
+ with
207
+ | :? OperationCanceledException as exn when ct.IsCancellationRequested -> ValueOrCancelled.Cancelled exn
208
+ | err -> ValueOrCancelled.Value( Choice2Of2 err)
206
209
207
210
match compRes with
208
211
| ValueOrCancelled.Value res ->
0 commit comments