mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Improve editor parsable errors
This commit is contained in:
parent
75c2a24b98
commit
4f7564b079
@ -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} *)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user