Skip to content

Commit 1c02a6b

Browse files
committed
fix: quiet down the logging
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
1 parent 956160a commit 1c02a6b

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

ocaml-lsp-server/src/dune.ml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,26 @@ end = struct
378378
(fun () -> Csexp_rpc.connect sock sockaddr)
379379
in
380380
match session with
381-
| Error exns ->
381+
| Error exns -> (
382382
Lev_fiber.Fd.close sock;
383-
let message =
384-
let exn = List.hd exns in
385-
Format.asprintf "unable to connect to dune %s@.%a"
386-
(Registry.Dune.root source)
387-
Exn_with_backtrace.pp_uncaught exn
388-
in
389-
let+ () = t.config.log ~type_:Error ~message in
390-
t.state <- Finished;
391-
Error ()
383+
match
384+
List.filter exns ~f:(fun exn ->
385+
match exn with
386+
| { Exn_with_backtrace.exn = Unix.Unix_error (ECONNREFUSED, _, _)
387+
; _
388+
} -> false
389+
| _ -> true)
390+
with
391+
| [] -> Fiber.return (Error ())
392+
| exn :: _ ->
393+
let message =
394+
Format.asprintf "unable to connect to dune %s@.%a"
395+
(Registry.Dune.root source)
396+
Exn_with_backtrace.pp_uncaught exn
397+
in
398+
let+ () = t.config.log ~type_:Error ~message in
399+
t.state <- Finished;
400+
Error ())
392401
| Ok session ->
393402
t.state <- Connected (session, where);
394403
Fiber.return (Ok ())

0 commit comments

Comments
 (0)