aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxime Dénès2016-10-28 12:42:10 +0200
committerMaxime Dénès2016-10-28 12:42:10 +0200
commit3e98d3e4941f5098d743dffa8a032fd623a6a030 (patch)
treeddfebc530ee37fce10f0cd6782c4504d9c20d486 /lib
parent40dbf1e0d8824fba357632addcdce434edc8b247 (diff)
parentcb5f55380875bb3029b051eb3acfbb912d83454b (diff)
Merge remote-tracking branch 'github/pr/319' into v8.6
Was PR#319: More error tagging, try to fix bug 5135
Diffstat (limited to 'lib')
-rw-r--r--lib/cErrors.ml14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/cErrors.ml b/lib/cErrors.ml
index c69c7e4001..5c56192fc5 100644
--- a/lib/cErrors.ml
+++ b/lib/cErrors.ml
@@ -16,6 +16,16 @@ let push = Backtrace.add_backtrace
exception Anomaly of string option * std_ppcmds (* System errors *)
+(* XXX: To move to common tagging functions in Pp, blocked on tag
+ * system cleanup as we cannot define generic error tags now.
+ *
+ * Anyways, tagging should not happen here, but in the specific
+ * listener to the msg_* stuff.
+ *)
+let tag_err_str s = tag Ppstyle.(Tag.inj error_tag tag) (str s) ++ spc ()
+let err_str = tag_err_str "Error:"
+let ann_str = tag_err_str "Anomaly:"
+
let _ =
let pr = function
| Anomaly (s, pp) -> Some ("\"Anomaly: " ^ string_of_ppcmds pp ^ "\"")
@@ -93,7 +103,7 @@ let print_backtrace e = match Backtrace.get_backtrace e with
let print_anomaly askreport e =
if askreport then
- hov 0 (str "Anomaly: " ++ raw_anomaly e ++ spc () ++
+ hov 0 (ann_str ++ raw_anomaly e ++ spc () ++
strbrk "Please report at " ++ str Coq_config.wwwbugtracker ++
str ".")
else
@@ -115,7 +125,7 @@ let iprint_no_report (e, info) =
let _ = register_handler begin function
| UserError(s, pps) ->
- hov 0 (str "Error: " ++ where (Some s) ++ pps)
+ hov 0 (err_str ++ where (Some s) ++ pps)
| _ -> raise Unhandled
end