[Git][ghc/ghc][wip/romes/25052] ghc-internal: No trailing whitespace in exceptions

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Tue Jul 23 14:27:56 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/25052 at Glasgow Haskell Compiler / GHC


Commits:
1fb2ac40 by Rodrigo Mesquita at 2024-07-23T15:27:48+01:00
ghc-internal: No trailing whitespace in exceptions

Fixes #25052

- - - - -


1 changed file:

- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs


Changes:

=====================================
libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
=====================================
@@ -199,11 +199,14 @@ instance Exception SomeException where
     fromException = Just
     backtraceDesired (SomeException e) = backtraceDesired e
     displayException (SomeException e) =
-        displayException e ++ "\n" ++ displayContext ?exceptionContext
+      case displayContext ?exceptionContext of
+        "" -> displayException e
+        dc -> displayException e ++ "\n" ++ dc
 
 displayContext :: ExceptionContext -> String
 displayContext (ExceptionContext anns0) = go anns0
   where
+    go [SomeExceptionAnnotation ann]        = displayExceptionAnnotation ann
     go (SomeExceptionAnnotation ann : anns) = displayExceptionAnnotation ann ++ "\n" ++ go anns
     go [] = ""
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1fb2ac40630a68a8db4af3fc483229cb4e71a8f7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1fb2ac40630a68a8db4af3fc483229cb4e71a8f7
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/20240723/37362f0e/attachment-0001.html>


More information about the ghc-commits mailing list