aboutsummaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorDavid Waern <david.waern@gmail.com>2009-02-25 20:04:38 +0000
committerDavid Waern <david.waern@gmail.com>2009-02-25 20:04:38 +0000
commitcc54e035026b266df4fd0ed6ef023cac203936ad (patch)
treeb4816a87d8f6a5c569dc39cf0c37f0cb76e9b515 /src/Main.hs
parent47bd922bea18b5f786dadedf08633320f3573211 (diff)
Fix bad error handling with newer GHCs
When support for GHC 6.10 was added, an error handler was installed only around the typechecking phase. This had the effect that errors thrown during dependency chasing were caught in the top-level exception handler and not printed with enough detail. With this patch we wrap the error handler around all our usage of the Ghc monad.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 328fce4d..05b71223 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -160,8 +160,14 @@ main = handleTopExceptions $ do
#endif
#if __GLASGOW_HASKELL__ >= 609
+ -- We have one global error handler for all GHC source errors. Other kinds
+ -- of exceptions will be propagated to the top-level error handler.
+ let handleSrcErrors action = flip handleSourceError action $ \err -> do
+ printExceptionAndWarnings err
+ liftIO exitFailure
+
-- initialize GHC
- startGhc libDir (ghcFlags flags) $ \dynflags -> do
+ startGhc libDir (ghcFlags flags) $ \dynflags -> handleSrcErrors $ do
-- get packages supplied with --read-interface
packages <- readInterfaceFiles nameCacheFromGhc (ifacePairs flags)