Skip to content

Commit d3c9698

Browse files
Don't catch runtime exceptions in Lwt_seq
1 parent 61d34af commit d3c9698

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/lwt_seq.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ let rec unfold f u () =
270270
match f u with
271271
| None -> return_nil
272272
| Some (x, u') -> Lwt.return (Cons (x, unfold f u'))
273-
| exception exc -> Lwt.fail exc
273+
| exception exc when Lwt.is_not_ocaml_runtime_exception exc -> Lwt.fail exc
274274

275275
let rec unfold_lwt f u () =
276276
let* x = f u in
@@ -305,7 +305,7 @@ let rec of_seq seq () =
305305
| Seq.Nil -> return_nil
306306
| Seq.Cons (x, next) ->
307307
Lwt.return (Cons (x, (of_seq next)))
308-
| exception exn -> Lwt.fail exn
308+
| exception exn when Lwt.is_not_ocaml_runtime_exception exn -> Lwt.fail exn
309309

310310
let rec of_seq_lwt (seq: 'a Lwt.t Seq.t): 'a t = fun () ->
311311
match seq () with
@@ -321,4 +321,4 @@ let of_seq_lwt (seq: 'a Lwt.t Seq.t): 'a t = fun () ->
321321
let+ x = x in
322322
let next = of_seq_lwt next in
323323
Cons (x, next)
324-
| exception exc -> Lwt.fail exc
324+
| exception exc when Lwt.is_not_ocaml_runtime_exception exc -> Lwt.fail exc

0 commit comments

Comments
 (0)