diff options
-rw-r--r-- | checker/checker.ml | 6 | ||||
-rw-r--r-- | lib/errors.mli | 9 |
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 |