[Git][ghc/ghc][wip/exception-context] compiler: Don't show ExceptionContext of GhcExceptions

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue Mar 5 02:53:31 UTC 2024



Ben Gamari pushed to branch wip/exception-context at Glasgow Haskell Compiler / GHC


Commits:
5dcc5481 by Ben Gamari at 2024-03-04T21:52:13-05:00
compiler: Don't show ExceptionContext of GhcExceptions

Most GhcExceptions are user-facing errors and therefore the
ExceptionContext has little value. Ideally we would enable
it in the DEBUG compiler but I am leaving this for future work.

- - - - -


1 changed file:

- compiler/GHC/Utils/Panic.hs


Changes:

=====================================
compiler/GHC/Utils/Panic.hs
=====================================
@@ -127,6 +127,10 @@ instance Exception GhcException where
           PlainProgramError str -> ProgramError str
     | otherwise = Nothing
 
+  -- Explicitly omit ExceptionContext since we generally don't
+  -- want backtraces and other context in GHC's user errors.
+  displayException = ghcGhcExceptionUnsafe
+
 instance Show GhcException where
   showsPrec _ e = showGhcExceptionUnsafe e
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5dcc5481a48f55d95ed12114e8eb31b405ec8039

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5dcc5481a48f55d95ed12114e8eb31b405ec8039
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240304/3ac686d3/attachment.html>


More information about the ghc-commits mailing list