Skip to content

Commit

Permalink
fix: quiet down the logging
Browse files Browse the repository at this point in the history
if we don't connect to dune, just stay quiet about it

Signed-off-by: Rudi Grinberg <[email protected]>

ps-id: 86B181B0-CDD7-4FB6-A52F-D7FE35CC986A
  • Loading branch information
rgrinberg committed May 19, 2022
1 parent 956160a commit 1c02a6b
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions ocaml-lsp-server/src/dune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -378,17 +378,26 @@ end = struct
(fun () -> Csexp_rpc.connect sock sockaddr)
in
match session with
| Error exns ->
| Error exns -> (
Lev_fiber.Fd.close sock;
let message =
let exn = List.hd exns in
Format.asprintf "unable to connect to dune %s@.%a"
(Registry.Dune.root source)
Exn_with_backtrace.pp_uncaught exn
in
let+ () = t.config.log ~type_:Error ~message in
t.state <- Finished;
Error ()
match
List.filter exns ~f:(fun exn ->
match exn with
| { Exn_with_backtrace.exn = Unix.Unix_error (ECONNREFUSED, _, _)
; _
} -> false
| _ -> true)
with
| [] -> Fiber.return (Error ())
| exn :: _ ->
let message =
Format.asprintf "unable to connect to dune %s@.%a"
(Registry.Dune.root source)
Exn_with_backtrace.pp_uncaught exn
in
let+ () = t.config.log ~type_:Error ~message in
t.state <- Finished;
Error ())
| Ok session ->
t.state <- Connected (session, where);
Fiber.return (Ok ())
Expand Down

0 comments on commit 1c02a6b

Please sign in to comment.