From bfa348652cc8d75240bccdbbad819998f0396726 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 8 Feb 2001 14:58:28 +0000 Subject: [PATCH] [project @ 2001-02-08 14:58:28 by simonmar] - print "*** Exception: " before an exception - use a recursive exception handler, so eg. error (error "wibble") doesn't panic the system --- ghc/compiler/ghci/InteractiveUI.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index f4e0800..d8f8f97 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.34 2001/02/07 10:45:43 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.35 2001/02/08 14:58:28 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -211,7 +211,8 @@ runCommand :: String -> GHCi Bool runCommand c = ghciHandle ( \other_exception - -> io (putStrLn (show other_exception)) >> return False + -> io (do putStrLn ("*** Exception: " ++ show other_exception) + return False) ) $ ghciHandleDyn (\dyn -> case dyn of @@ -574,10 +575,13 @@ setLastExpr last_expr io m = GHCi $ \s -> m >>= \a -> return (s,a) +-- recursive exception handlers +ghciHandle :: (Exception -> GHCi a) -> GHCi a -> GHCi a ghciHandle h (GHCi m) = GHCi $ \s -> - Exception.catch (m s) (\e -> unGHCi (h e) s) + Exception.catch (m s) (\e -> unGHCi (ghciHandle h (h e)) s) + ghciHandleDyn h (GHCi m) = GHCi $ \s -> - Exception.catchDyn (m s) (\e -> unGHCi (h e) s) + Exception.catchDyn (m s) (\e -> unGHCi (ghciHandleDyn h (h e)) s) ----------------------------------------------------------------------------- -- package loader -- 1.7.10.4