on master help sign in
make message on Haskell exceptions a bit easier to read
221c71eEvan Czaplicki
builder/src/Reporting.hs+7−5
@@ -33,7 +33,7 @@ import qualified Data.ByteString.Builder as B
33import qualified Data.NonEmptyList as NE
33import qualified Data.NonEmptyList as NE
34import qualified System.Exit as Exit
34import qualified System.Exit as Exit
35import qualified System.Info as Info
35import qualified System.Info as Info
36−import System.IO (hFlush, hPutStr, stderr, stdout)
36+import System.IO (hFlush, hPutStr, hPutStrLn, stderr, stdout)
37
37
38import qualified Elm.ModuleName as ModuleName
38import qualified Elm.ModuleName as ModuleName
39import qualified Elm.Package as Pkg
39import qualified Elm.Package as Pkg
@@ -446,17 +446,19 @@ reportExceptionsNicely e =
446
446
447
447
448putException :: SomeException -> IO ()
448putException :: SomeException -> IO ()
449−putException e =
449+putException e = do
450+ hPutStrLn stderr ""
450 Help.toStderr $ D.stack $
451 Help.toStderr $ D.stack $
452+ [ D.dullyellow "-- ERROR -----------------------------------------------------------------------"
451− [ D.reflow $
453+ , D.reflow $
452− "Oh no! I ran into something that bypassed the normal error reporting process!\
454+ "I ran into something that bypassed the normal error reporting process!\
453 \ I extracted whatever information I could from the internal error:"
455 \ I extracted whatever information I could from the internal error:"
454 , D.vcat $ map (\line -> D.red ">" <> " " <> D.fromChars line) (lines (show e))
456 , D.vcat $ map (\line -> D.red ">" <> " " <> D.fromChars line) (lines (show e))
455 , D.reflow $
457 , D.reflow $
456 "These errors are usually pretty confusing, so start by asking around on one of\
458 "These errors are usually pretty confusing, so start by asking around on one of\
457 \ forums listed at https://elm-lang.org/community to see if anyone can get you\
459 \ forums listed at https://elm-lang.org/community to see if anyone can get you\
458 \ unstuck quickly."
460 \ unstuck quickly."
459− , "------------------------------------------------------------"
461+ , D.dullyellow "-- REQUEST ---------------------------------------------------------------------"
460 , D.reflow $
462 , D.reflow $
461 "If you are feeling up to it, please try to get your code down to the smallest\
463 "If you are feeling up to it, please try to get your code down to the smallest\
462 \ version that still triggers this message. Ideally in a single Main.elm and\
464 \ version that still triggers this message. Ideally in a single Main.elm and\