From: simonmar Date: Thu, 8 Feb 2001 14:58:28 +0000 (+0000) Subject: [project @ 2001-02-08 14:58:28 by simonmar] X-Git-Tag: Approximately_9120_patches~2707 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=bfa348652cc8d75240bccdbbad819998f0396726;p=ghc-hetmet.git [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 --- 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