Skip to content

Commit

Permalink
Don't catch runtime exceptions in Lwt_seq
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael-proust committed Oct 27, 2022
1 parent fca879e commit e914f3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/lwt_seq.ml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ let rec unfold f u () =
match f u with
| None -> return_nil
| Some (x, u') -> Lwt.return (Cons (x, unfold f u'))
| exception exc -> Lwt.fail exc
| exception exc when Lwt.is_not_ocaml_runtime_exception exc -> Lwt.fail exc

let rec unfold_lwt f u () =
let* x = f u in
Expand Down Expand Up @@ -305,7 +305,7 @@ let rec of_seq seq () =
| Seq.Nil -> return_nil
| Seq.Cons (x, next) ->
Lwt.return (Cons (x, (of_seq next)))
| exception exn -> Lwt.fail exn
| exception exn when Lwt.is_not_ocaml_runtime_exception exn -> Lwt.fail exn

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

0 comments on commit e914f3b

Please sign in to comment.