The E.*_s and S.*_s combinators all eat exceptions raised by the function-argument:
#!/usr/bin/env -S opam exec -- utop
#thread
#require "lwt"
#require "lwt.unix"
#require "lwt_react"
open Lwt.Syntax
open Lwt_react
let tick_e, tick_eupd = E.create ()
let tick_s = S.hold () tick_e
(*> Works*)
let e0 = tick_e |> E.map (fun _ -> failwith "error")
(*> No exception is printed - and program doesn't terminate*)
let e1 = tick_e |> E.map_s (fun _ -> failwith "error")
(*> Works*)
let e2 = tick_e |> E.map_p (fun _ -> failwith "error")
(*> No exception is printed - and program doesn't terminate*)
let e3 = tick_e |> E.fmap_s (fun _ -> failwith "error")
(*> No exception is printed - and program doesn't terminate*)
let s0 = tick_s |> S.map_s (fun _ -> failwith "error")
let rec feed_tick () = let* () = Lwt_unix.sleep 0.5 in tick_eupd (); feed_tick ()
let () = Lwt_main.run @@ loop ()
The exception is neither printed nor leading to program exit. From the source, this seems to be everywhere where Lwt_mutex.with_lock is used to wrap the given function
The
E.*_sandS.*_scombinators all eat exceptions raised by the function-argument:The exception is neither printed nor leading to program exit. From the source, this seems to be everywhere where
Lwt_mutex.with_lockis used to wrap the given function