From 4f7564b0795c6c0d874bd022fd54468781e201f8 Mon Sep 17 00:00:00 2001 From: Denis Merigoux Date: Tue, 18 Apr 2023 09:49:12 +0200 Subject: [PATCH] Improve editor parsable errors --- compiler/catala_utils/errors.ml | 10 +++++----- compiler/catala_web_interpreter.ml | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/compiler/catala_utils/errors.ml b/compiler/catala_utils/errors.ml index 3e9d176d..a2ecab6d 100644 --- a/compiler/catala_utils/errors.ml +++ b/compiler/catala_utils/errors.ml @@ -38,17 +38,17 @@ let print_structured_error (msg : string) (pos : (string option * Pos.t) list) : pos)) | Cli.EditorParsable -> let remove_new_lines s = - Re.replace ~all:true (Re.compile (Re.char '\n')) ~f:(fun _ -> " | ") s + Re.replace ~all:true (Re.compile (Re.char '\n')) ~f:(fun _ -> " ยท ") s in - "\n" + remove_new_lines msg + ^ "\n" ^ String.concat "\n" (List.map (fun (msg', pos) -> Printf.sprintf "%s%s" (Pos.to_string_short pos) (match msg' with - | None -> remove_new_lines msg - | Some msg' -> - remove_new_lines msg ^ " | " ^ remove_new_lines msg')) + | None -> "" + | Some msg' -> remove_new_lines msg')) pos) (** {1 Error exception and printing} *) diff --git a/compiler/catala_web_interpreter.ml b/compiler/catala_web_interpreter.ml index 4339db46..8f58033a 100644 --- a/compiler/catala_web_interpreter.ml +++ b/compiler/catala_web_interpreter.ml @@ -22,6 +22,7 @@ let _ = language = Some (Js.to_string language); max_prec_digits = None; closure_conversion = false; + message_format = Human; trace; disable_warnings = true; disable_counterexamples = false;