Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit c7e7758a authored by Sylvain Dailler's avatar Sylvain Dailler

Parsing error dont go through Error where they are catched by a debug flag.

They are always printed with new message Parse_Or_Type_Error.
File_contents and Get_file added where missing.
Indentation updated in json_util
parent 8d009126
......@@ -898,6 +898,7 @@ let treat_message_notification msg = match msg with
| Information s -> print_message "%s" s
| Task_Monitor (t, s, r) -> update_monitor t s r
| Open_File_Error s -> print_message "%s" s
| Parse_Or_Type_Error s -> print_message "%s" s
| Error s ->
if Debug.test_flag debug then
print_message "%s" s
......
......@@ -32,6 +32,7 @@ type message_notification =
| Help of string
| Information of string
| Task_Monitor of int * int * int
| Parse_Or_Type_Error of string
| Error of string
| Open_File_Error of string
......
......@@ -35,6 +35,8 @@ type message_notification =
| Information of string
(* Number of task scheduled, running, etc *)
| Task_Monitor of int * int * int
(* A file was read or reloaded and now contains a parsing or typing error *)
| Parse_Or_Type_Error of string
(* An error happened that could not be identified in server *)
| Error of string
| Open_File_Error of string
......
......@@ -304,6 +304,7 @@ let print_msg fmt m =
| Help _s -> fprintf fmt "help"
| Information s -> fprintf fmt "info %s" s
| Task_Monitor _ -> fprintf fmt "task montor"
| Parse_Or_Type_Error s -> fprintf fmt "parse_or_type_error:\n %s" s
| Error s -> fprintf fmt "%s" s
| Open_File_Error s -> fprintf fmt "%s" s
......@@ -334,25 +335,25 @@ module Make (S:Controller_itp.Scheduler) (P:Protocol) = struct
try cont_from_session_dir cont f; true with
| e ->
let s = Format.asprintf "%a@." Exn_printer.exn_printer e in
P.notify (Message (Error s)); false
P.notify (Message (Parse_Or_Type_Error s)); false
let cont_from_file cont f =
try cont_from_file cont f; true with
| e ->
let s = Format.asprintf "%a@." Exn_printer.exn_printer e in
P.notify (Message (Error s)); false
P.notify (Message (Parse_Or_Type_Error s)); false
let reload_files cont ~use_shapes =
try reload_files cont ~use_shapes; true with
| e ->
let s = Format.asprintf "%a@." Exn_printer.exn_printer e in
P.notify (Message (Error s)); false
P.notify (Message (Parse_Or_Type_Error s)); false
let add_file c ?format fname =
try add_file c ?format fname; true with
| e ->
let s = Format.asprintf "%a@." Exn_printer.exn_printer e in
P.notify (Message (Error s)); false
P.notify (Message (Parse_Or_Type_Error s)); false
let debug = Debug.register_flag "itp_server" ~desc:"ITP server"
......@@ -715,9 +716,9 @@ module Make (S:Controller_itp.Scheduler) (P:Protocol) = struct
}
in
try (
if (Sys.file_exists f) then
if Sys.file_exists f then
begin
if (Sys.is_directory f) then
if Sys.is_directory f then
begin
let b = cont_from_session_dir d.cont f in
if b then
......
......@@ -93,6 +93,7 @@ let convert_notification_constructor n =
| Message _ -> String "Message"
| Dead _ -> String "Dead"
| Task _ -> String "Task"
| File_contents _ -> String "File_contents"
let convert_node_type_string nt =
match nt with
......@@ -115,6 +116,7 @@ let convert_request_constructor (r: ide_request) =
| Open_session_req _ -> String "Open_session_req"
| Add_file_req _ -> String "Add_file_req"
| Set_max_tasks_req _ -> String "Set_max_tasks_req"
| Get_file_contents _ -> String "Get_file_contents"
| Get_task _ -> String "Get_task"
| Remove_subtree _ -> String "Remove_subtree"
| Copy_paste _ -> String "Copy_paste"
......@@ -158,6 +160,9 @@ let print_request_to_json (r: ide_request): Json_base.value =
| Get_task n ->
Obj ["ide_request", cc r;
"node_ID", Int n]
| Get_file_contents s ->
Obj ["ide_request", cc r;
"file", String s]
| Remove_subtree n ->
Obj ["ide_request", cc r;
"node_ID", Int n]
......@@ -190,6 +195,7 @@ let convert_constructor_message (m: message_notification) =
| Help _ -> String "Help"
| Information _ -> String "Information"
| Task_Monitor _ -> String "Task_Monitor"
| Parse_Or_Type_Error _ -> String "Parse_Or_Type_Error"
| Error _ -> String "Error"
| Open_File_Error _ -> String "Open_File_Error"
......@@ -229,6 +235,9 @@ let convert_message (m: message_notification) =
| Task_Monitor (n, k, p) ->
Obj ["mess_notif", cc m;
"monitor", Array [Int n; Int k; Int p]]
| Parse_Or_Type_Error s ->
Obj ["mess_notif", cc m;
"error", String s]
| Error s ->
Obj ["mess_notif", cc m;
"error", String s]
......@@ -268,6 +277,10 @@ let print_notification_to_json (n: notification): Json_base.value =
Obj ["notification", cc n;
"node_ID", Int nid;
"task", String s]
| File_contents (f, s) ->
Obj ["notification", cc n;
"file", String f;
"content", String s]
let print_notification fmt (n: notification) =
Format.fprintf fmt "%a" Json_base.print (print_notification_to_json n)
......
......@@ -109,6 +109,7 @@ g -> print the current task\n\
p -> print the session@." s
| Information s -> fprintf fmt "%s@." s
| Task_Monitor (_t, _s, _r) -> () (* TODO do we want to print something for this? *)
| Parse_Or_Type_Error s -> fprintf fmt "%s@." s
| Error s ->
fprintf fmt "%s@." s
| Open_File_Error s -> fprintf fmt "%s@." s
......
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