aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-03-17 22:00:33 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2013-03-17 22:00:33 +0000
commit70d582a7e191420661506a0e71fa022d1160626e (patch)
tree963ecb59798131ba9250f01354443b46316a42f8
parent60902645ba29f967883fdfe8aa46ef6f4a80ac7d (diff)
Checker: simplify a bit its exception handler
We use Errors.print for anomalies and other uncaught exceptions in the checker: this should print the same message, it is shorter this way, and we avoid using Errors.is_anomaly. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16310 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--checker/checker.ml6
-rw-r--r--lib/errors.mli9
2 files changed, 5 insertions, 10 deletions
diff --git a/checker/checker.ml b/checker/checker.ml
index 10a3089ed..6b76b6b32 100644
--- a/checker/checker.ml
+++ b/checker/checker.ml
@@ -278,11 +278,7 @@ let rec explain_exn = function
str ", characters " ++ int e ++ str "-" ++
int (e+6) ++ str ")")) ++
report ())
- | e when is_anomaly e ->
- print_anomaly e
- | e ->
- hov 0 (anomaly_string () ++ str "Uncaught exception " ++
- str (Printexc.to_string e)++report())
+ | e -> Errors.print e (* for anomalies and other uncaught exceptions *)
let parse_args argv =
let rec parse = function
diff --git a/lib/errors.mli b/lib/errors.mli
index a7f4ef0cd..7e296e45e 100644
--- a/lib/errors.mli
+++ b/lib/errors.mli
@@ -29,7 +29,9 @@ val anomaly : ?loc:Loc.t -> ?label:string -> std_ppcmds -> 'a
label identifying the anomaly. *)
val is_anomaly : exn -> bool
-(** Check whether a given exception is an anomaly. *)
+(** Check whether a given exception is an anomaly.
+ This is mostly provided for compatibility. Please avoid doing specific
+ tricks with anomalies thanks to it. See rather [noncritical] below. *)
exception UserError of string * std_ppcmds
val error : string -> 'a
@@ -74,16 +76,13 @@ val register_handler : (exn -> Pp.std_ppcmds) -> unit
(** The standard exception printer *)
val print : exn -> Pp.std_ppcmds
-(** Exception printer dedicated to anomalies. *)
-val print_anomaly : exn -> Pp.std_ppcmds
-
(** Same as [print], except that the "Please report" part of an anomaly
isn't printed (used in Ltac debugging). *)
val print_no_report : exn -> Pp.std_ppcmds
(** Critical exceptions shouldn't be catched and ignored by mistake
by inner functions during a [vernacinterp]. They should be handled
- only at the very end of interp, to be displayed to the user.
+ only in [Toplevel.do_vernac] (or Ideslave), to be displayed to the user.
Typical example: [Sys.Break], [Assert_failure], [Anomaly] ...
*)
val noncritical : exn -> bool