mirror of
https://github.com/c-cube/linol.git
synced 2025-12-06 03:05:31 -05:00
Use IO.catch in async
This commit is contained in:
parent
8123e95a5f
commit
262e57e7c2
1 changed files with 8 additions and 4 deletions
|
|
@ -76,10 +76,14 @@ module Make (IO : IO) = struct
|
||||||
end
|
end
|
||||||
|
|
||||||
let async (self : #base_server) f : unit IO.t =
|
let async (self : #base_server) f : unit IO.t =
|
||||||
self#spawn_query_handler
|
self#spawn_query_handler (fun () ->
|
||||||
(fun () -> try f () with err ->
|
IO.catch f (fun exn bt ->
|
||||||
Log.err (fun k -> k "LSP async notification handler failed: %s" (Printexc.to_string err));
|
let msg =
|
||||||
IO.return ());
|
spf "LSP async notification handler failed with %s\n%s"
|
||||||
|
(Printexc.to_string exn)
|
||||||
|
(Printexc.raw_backtrace_to_string bt)
|
||||||
|
in
|
||||||
|
IO.return @@ Log.err (fun k -> k "%s" msg)));
|
||||||
IO.return ()
|
IO.return ()
|
||||||
|
|
||||||
(** A wrapper to more easily reply to notifications *)
|
(** A wrapper to more easily reply to notifications *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue