From 07abf9818a6b47bb2c2bd0a8201da9743a0c10b6 Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Sun, 3 Mar 2019 16:49:30 +0100 Subject: [error] Remove special error printing pre-processing We remove the special error printing pre-processing in favor of just calling the standard printers. Error printing has been a bit complex for a while due to an incomplete migration to a new printing scheme based on registering exception printers; this PR should alleviate that by completing the registration approach. After this cleanup, it should not be ever necessary for normal functions to worry a lot about catching errors and re-raising them, unless they have some very special needs. This change also allows to consolidate the `explainErr` and `himsg` modules into one, removing the need to export the error printing functions. Ideally we would make the contents of `himsg` more localized, but this can be done in a gradual way. --- plugins/ltac/tactic_debug.ml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'plugins/ltac/tactic_debug.ml') diff --git a/plugins/ltac/tactic_debug.ml b/plugins/ltac/tactic_debug.ml index 3014ba5115..9e735e0680 100644 --- a/plugins/ltac/tactic_debug.ml +++ b/plugins/ltac/tactic_debug.ml @@ -33,12 +33,8 @@ type debug_info = | DebugOff (* An exception handler *) -let explain_logic_error e = - CErrors.print (fst (ExplainErr.process_vernac_interp_error (e, Exninfo.null))) - -let explain_logic_error_no_anomaly e = - CErrors.print_no_report - (fst (ExplainErr.process_vernac_interp_error (e, Exninfo.null))) +let explain_logic_error e = CErrors.print e +let explain_logic_error_no_anomaly e = CErrors.print_no_report e let msg_tac_debug s = Proofview.NonLogical.print_debug (s++fnl()) let msg_tac_notice s = Proofview.NonLogical.print_notice (s++fnl()) @@ -370,8 +366,9 @@ let explain_ltac_call_trace last trace loc = strbrk " (with " ++ prlist_with_sep pr_comma (fun (id,c) -> - (* XXX: This hooks into the ExplainErr extension API - so it is tricky to provide the right env for now. *) + (* XXX: This hooks into the CErrors's additional error + info API so it is tricky to provide the right env for + now. *) let env = Global.env () in let sigma = Evd.from_env env in Id.print id ++ str ":=" ++ Printer.pr_lconstr_under_binders_env env sigma c) @@ -424,11 +421,11 @@ let extract_ltac_trace ?loc trace = aux loc trace in best_loc, None -let get_ltac_trace (_, info) = +let get_ltac_trace info = let ltac_trace = Exninfo.get info ltac_trace_info in let loc = Loc.get_loc info in match ltac_trace with | None -> None | Some trace -> Some (extract_ltac_trace ?loc trace) -let () = ExplainErr.register_additional_error_info get_ltac_trace +let () = CErrors.register_additional_error_info get_ltac_trace -- cgit v1.2.3