From 6dcc7528265b7a2383598314c6ecd38270668f9c Mon Sep 17 00:00:00 2001 From: Clombrong Date: Tue, 24 Jun 2025 12:39:28 +0200 Subject: fix(websockets_hello): "handle" exceptions via print_endline --- test/js/websockets_hello.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/js/websockets_hello.ml b/test/js/websockets_hello.ml index e5f75f6..91c2b70 100644 --- a/test/js/websockets_hello.ml +++ b/test/js/websockets_hello.ml @@ -37,4 +37,12 @@ let () = let* stream, push = Stream.start domain in Lwt.catch (fun () -> main (stream, push) config >|= (fun () -> push None)) - (fun exn -> push None; Lwt.fail exn) + (fun exn -> + push None; + (* I suspect JavaScript's [wrap_callback] swallows the Exceptions thrown by + OCaml, so... The next best thing is probably printing something. *) + print_endline + (match exn with + | Stream.InvalidStanza stanza -> "Invalid stanza: " ^ stanza + | _ -> "... and so I stumble back to bed."); + Lwt.fail exn) -- cgit v1.2.3