Commit 949591b5 authored by DAILLER Sylvain's avatar DAILLER Sylvain

Merge branch 'socket_error' into 'master'

Socket error

See merge request !114
parents b1805227 fe261a9b
......@@ -14,6 +14,7 @@ let socket : Unix.file_descr option ref = ref None
exception NotConnected
exception AlreadyConnected
exception InvalidAnswer of string
exception ConnectionError of string
let is_connected () = !socket <> None
......@@ -32,12 +33,13 @@ let client_connect ~fail socket_name =
socket := Some sock
with
| Unix.Unix_error(err, func, arg) when fail ->
Format.eprintf "client_connect: connection failed: %s (%s,%s) (socket_name=%s)@." (Unix.error_message err) func arg socket_name;
exit 2
let s = Format.sprintf "client_connect: connection failed: %s (%s,%s) (socket_name=%s)@."
(Unix.error_message err) func arg socket_name in
raise (ConnectionError s)
| e when fail ->
Format.eprintf "client_connect failed for some unexpected reason: %s@\nAborting.@."
(Printexc.to_string e);
exit 2
let s = Format.sprintf "client_connect failed for some unexpected reason: %s@\nAborting.@."
(Printexc.to_string e) in
raise (ConnectionError s)
let client_disconnect () =
match !socket with
......@@ -238,4 +240,6 @@ let () = Exn_printer.register (fun fmt exn -> match exn with
Format.fprintf fmt "Already connected to the proof server"
| InvalidAnswer s ->
Format.fprintf fmt "Invalid server answer: %s" s
| ConnectionError s ->
Format.fprintf fmt "Connection error: %s" s
| _ -> raise exn)
......@@ -10,6 +10,7 @@
(********************************************************************)
exception AlreadyConnected
exception ConnectionError of string
val connect_external : string -> unit
(** connects to an already running server, with the given socket name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment