summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Error.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Utils/Error.hs')
-rw-r--r--compiler/GHC/Utils/Error.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/Utils/Error.hs b/compiler/GHC/Utils/Error.hs
index 654c4b91a9..bad8a8b092 100644
--- a/compiler/GHC/Utils/Error.hs
+++ b/compiler/GHC/Utils/Error.hs
@@ -820,13 +820,15 @@ prettyPrintGhcErrors :: ExceptionMonad m => DynFlags -> m a -> m a
prettyPrintGhcErrors dflags
= MC.handle $ \e -> case e of
PprPanic str doc ->
- pprDebugAndThen dflags panic (text str) doc
+ pprDebugAndThen ctx panic (text str) doc
PprSorry str doc ->
- pprDebugAndThen dflags sorry (text str) doc
+ pprDebugAndThen ctx sorry (text str) doc
PprProgramError str doc ->
- pprDebugAndThen dflags pgmError (text str) doc
+ pprDebugAndThen ctx pgmError (text str) doc
_ ->
liftIO $ throwIO e
+ where
+ ctx = initSDocContext dflags defaultUserStyle
-- | Checks if given 'WarnMsg' is a fatal warning.
isWarnMsgFatal :: DynFlags -> WarnMsg -> Maybe (Maybe WarningFlag)