diff options
author | Ian Lynagh <igloo@earth.li> | 2012-06-11 17:25:08 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-06-11 17:25:08 +0100 |
commit | fa362ab59b9c17afcbd71318cffc873ea224449e (patch) | |
tree | 241672fc4acd560bb32433bd3221964bbcc095fc /compiler/main/ErrUtils.lhs | |
parent | dff06f8e0ec0cd7a7d88e4d0f114661cfca95b81 (diff) | |
download | haskell-fa362ab59b9c17afcbd71318cffc873ea224449e.tar.gz |
Change how pprPanic works
We now include the String and the SDoc in the exception, and don't
flatten them into a String until near the top-level
Diffstat (limited to 'compiler/main/ErrUtils.lhs')
-rw-r--r-- | compiler/main/ErrUtils.lhs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index 5eaaa8d5bc..d694c28d12 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -29,13 +29,17 @@ module ErrUtils ( compilationProgressMsg, showPass, debugTraceMsg, + + prettyPrintGhcErrors, ) where #include "HsVersions.h" import Bag ( Bag, bagToList, isEmptyBag, emptyBag ) +import Exception import Util import Outputable +import Panic import FastString import SrcLoc import DynFlags @@ -329,5 +333,12 @@ showPass dflags what debugTraceMsg :: DynFlags -> Int -> MsgDoc -> IO () debugTraceMsg dflags val msg = ifVerbose dflags val (log_action dflags SevInfo noSrcSpan defaultDumpStyle msg) + +prettyPrintGhcErrors :: ExceptionMonad m => m a -> m a +prettyPrintGhcErrors = ghandle $ \e -> case e of + PprPanic str doc -> + pprDebugAndThen panic str doc + _ -> + throw e \end{code} |