Skip to content

Commit 221c71e

Browse files
committed
make message on Haskell exceptions a bit easier to read
1 parent fb03980 commit 221c71e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

builder/src/Reporting.hs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import qualified Data.ByteString.Builder as B
3333
import qualified Data.NonEmptyList as NE
3434
import qualified System.Exit as Exit
3535
import qualified System.Info as Info
36-
import System.IO (hFlush, hPutStr, stderr, stdout)
36+
import System.IO (hFlush, hPutStr, hPutStrLn, stderr, stdout)
3737

3838
import qualified Elm.ModuleName as ModuleName
3939
import qualified Elm.Package as Pkg
@@ -446,17 +446,19 @@ reportExceptionsNicely e =
446446

447447

448448
putException :: SomeException -> IO ()
449-
putException e =
449+
putException e = do
450+
hPutStrLn stderr ""
450451
Help.toStderr $ D.stack $
451-
[ D.reflow $
452-
"Oh no! I ran into something that bypassed the normal error reporting process!\
452+
[ D.dullyellow "-- ERROR -----------------------------------------------------------------------"
453+
, D.reflow $
454+
"I ran into something that bypassed the normal error reporting process!\
453455
\ I extracted whatever information I could from the internal error:"
454456
, D.vcat $ map (\line -> D.red ">" <> " " <> D.fromChars line) (lines (show e))
455457
, D.reflow $
456458
"These errors are usually pretty confusing, so start by asking around on one of\
457459
\ forums listed at https://elm-lang.org/community to see if anyone can get you\
458460
\ unstuck quickly."
459-
, "------------------------------------------------------------"
461+
, D.dullyellow "-- REQUEST ---------------------------------------------------------------------"
460462
, D.reflow $
461463
"If you are feeling up to it, please try to get your code down to the smallest\
462464
\ version that still triggers this message. Ideally in a single Main.elm and\

0 commit comments

Comments
 (0)