From 4444768d3f4f9c4fcdd440f7ab902886bd8e2b09 Mon Sep 17 00:00:00 2001 From: Thomas Sibut-Pinote Date: Tue, 23 Jun 2015 14:49:01 +0200 Subject: Moved fatal_error from Coqtop to Errors and corrected dependencies accordingly. This allows fatal_error to be used for printing anomalies at loading time. --- lib/errors.ml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/errors.ml') diff --git a/lib/errors.ml b/lib/errors.ml index c60442654a..c1d224dfcd 100644 --- a/lib/errors.ml +++ b/lib/errors.ml @@ -129,3 +129,13 @@ let handled e = let bottom _ = raise Bottom in try let _ = print_gen bottom !handle_stack e in true with Bottom -> false + +(** Prints info which is either an error or + an anomaly and then exits with the appropriate + error code *) + +let fatal_error info anomaly = + let msg = info ++ fnl () in + pp_with ~pp_tag:Ppstyle.pp_tag !Pp_control.err_ft msg; + flush_all (); + exit (if anomaly then 129 else 1) -- cgit v1.2.3