mirror of
https://github.com/c-cube/linol.git
synced 2025-12-05 19:00:34 -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
|
||||
|
||||
let async (self : #base_server) f : unit IO.t =
|
||||
self#spawn_query_handler
|
||||
(fun () -> try f () with err ->
|
||||
Log.err (fun k -> k "LSP async notification handler failed: %s" (Printexc.to_string err));
|
||||
IO.return ());
|
||||
self#spawn_query_handler (fun () ->
|
||||
IO.catch f (fun exn bt ->
|
||||
let msg =
|
||||
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 ()
|
||||
|
||||
(** A wrapper to more easily reply to notifications *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue