added transform_exceptions: bool ref;
authorwenzelm
Mon, 04 Jul 2005 17:09:15 +0200
changeset 16683 f1ea17a4f222
parent 16682 154a84e1a4f7
child 16684 7b58002668c0
added transform_exceptions: bool ref;
src/Pure/General/output.ML
--- a/src/Pure/General/output.ML	Mon Jul 04 17:08:19 2005 +0200
+++ b/src/Pure/General/output.ML	Mon Jul 04 17:09:15 2005 +0200
@@ -68,6 +68,7 @@
   val raw: string -> string
   val add_mode: string ->
     (string -> string * real) * (string * int -> string) * (string -> string) -> unit
+  val transform_exceptions: bool ref
 end;
 
 structure Output: OUTPUT =
@@ -196,18 +197,24 @@
 
 (* transform ERROR into ERROR_MESSAGE *)
 
+val transform_exceptions = ref true;
+
 exception ERROR_MESSAGE of string;
 
 fun transform_error f x =
-  (case handle_error f x of
-    OK y => y
-  | Error msg => raise ERROR_MESSAGE msg);
+  if ! transform_exceptions then
+    (case handle_error f x of
+      OK y => y
+    | Error msg => raise ERROR_MESSAGE msg)
+  else f x;
 
 
 (* transform any exception, including ERROR *)
 
 fun transform_failure exn f x =
-  transform_error f x handle Interrupt => raise Interrupt | e => raise exn e;
+  if ! transform_exceptions then
+    transform_error f x handle Interrupt => raise Interrupt | e => raise exn e
+  else f x;