Skip to content

Commit

Permalink
[server] Better error messages for --connect
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Sep 8, 2023
1 parent 9bbd10f commit 44c9abd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/compiler/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,11 @@ let init_wait_stdio() =
(* The connect function to connect to [host] at [port] and send arguments [args]. *)
let do_connect host port args =
let sock = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in
(try Unix.connect sock (Unix.ADDR_INET (Unix.inet_addr_of_string host,port)) with _ -> failwith ("Couldn't connect on " ^ host ^ ":" ^ string_of_int port));
(try Unix.connect sock (Unix.ADDR_INET (Unix.inet_addr_of_string host,port)) with
| Unix.Unix_error(code,_,_) -> failwith
("Couldn't connect on " ^ host ^ ":" ^ string_of_int port ^ " (" ^ (Unix.error_message code) ^ ")");
| _ -> failwith ("Couldn't connect on " ^ host ^ ":" ^ string_of_int port)
);
let rec display_stdin args =
match args with
| [] -> ""
Expand Down

0 comments on commit 44c9abd

Please sign in to comment.