aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2015-05-18 17:47:58 +0200
committerPierre-Marie Pédrot2015-05-18 19:04:32 +0200
commitea3909466eaaf86ff212c0a002e5df11e4a979f5 (patch)
tree2fd23c2ffa95c3bcfcd5c3e15404716dbc4df283 /lib
parentb994685d85d30f0db8ee0ec10f802f6bf3797e4b (diff)
The Fail command does not catch uncaught exception anomalies anymore.
Diffstat (limited to 'lib')
-rw-r--r--lib/errors.ml9
-rw-r--r--lib/errors.mli4
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/errors.ml b/lib/errors.ml
index 999d99ee08..c60442654a 100644
--- a/lib/errors.ml
+++ b/lib/errors.ml
@@ -120,3 +120,12 @@ let noncritical = function
| Timeout | Drop | Quit -> false
| Invalid_argument "equal: functional value" -> false
| _ -> true
+
+(** Check whether an exception is handled *)
+
+exception Bottom
+
+let handled e =
+ let bottom _ = raise Bottom in
+ try let _ = print_gen bottom !handle_stack e in true
+ with Bottom -> false
diff --git a/lib/errors.mli b/lib/errors.mli
index 5bd5724746..8320ce409f 100644
--- a/lib/errors.mli
+++ b/lib/errors.mli
@@ -88,3 +88,7 @@ val iprint_no_report : Exninfo.iexn -> Pp.std_ppcmds
Typical example: [Sys.Break], [Assert_failure], [Anomaly] ...
*)
val noncritical : exn -> bool
+
+(** Check whether an exception is handled by some toplevel printer. The
+ [Anomaly] exception is never handled. *)
+val handled : exn -> bool