Add back padding when errors/traces actually occur

This commit is contained in:
Dan Doel 2024-04-16 14:26:28 -04:00
parent 9f2089798f
commit 12ec621d23
6 changed files with 13 additions and 3 deletions

View File

@ -1073,7 +1073,7 @@ bugMsg ppe tr name (errs, tm) =
stackTrace :: PrettyPrintEnv -> [(Reference, Int)] -> Pretty ColorText
stackTrace _ [] = mempty
stackTrace ppe tr = "Stack trace:\n" <> P.indentN 2 (P.lines $ f <$> tr)
stackTrace ppe tr = "\nStack trace:\n" <> P.indentN 2 (P.lines $ f <$> tr)
where
f (rf, n) = name <> count
where
@ -1223,8 +1223,8 @@ tabulateErrors :: Set DecompError -> Error
tabulateErrors errs | null errs = mempty
tabulateErrors errs =
P.indentN 2 . P.lines $
P.wrap "The following errors occured while decompiling:"
: (listErrors errs)
"" : P.wrap "The following errors occured while decompiling:"
: (listErrors errs)
restoreCache :: StoredCache -> IO CCache
restoreCache (SCache cs crs trs ftm fty int rtm rty sbs) =

View File

@ -52,6 +52,7 @@ test2 = do
(typeLink IOFailure)
"Cannot decode byte '\\xee': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream"
(Any ())
Stack trace:
##raise
@ -64,6 +65,7 @@ test2 = do
The program halted with an unhandled exception:
Failure (typeLink RuntimeFailure) "builtin.bug" (Any "whoa")
Stack trace:
##raise

View File

@ -92,6 +92,7 @@ myServer = unsafeRun! '(hello "127.0.0.1" "0")
value:
Failure (typeLink IOFailure) "problem" (Any ())
Stack trace:
bug
#8ppr1tt4q2

View File

@ -615,6 +615,7 @@ Calling our examples with the wrong number of args will error.
The program halted with an unhandled exception:
Failure (typeLink IOFailure) "called with args" (Any ())
Stack trace:
##raise
@ -627,6 +628,7 @@ Calling our examples with the wrong number of args will error.
The program halted with an unhandled exception:
Failure (typeLink IOFailure) "called with no args" (Any ())
Stack trace:
##raise
@ -640,6 +642,7 @@ Calling our examples with the wrong number of args will error.
Failure
(typeLink IOFailure) "called with too many args" (Any ())
Stack trace:
##raise
@ -652,6 +655,7 @@ Calling our examples with the wrong number of args will error.
The program halted with an unhandled exception:
Failure (typeLink IOFailure) "called with no args" (Any ())
Stack trace:
##raise

View File

@ -22,6 +22,7 @@
value:
"implement me later"
Stack trace:
todo
#qe5e1lcfn8
@ -48,6 +49,7 @@
value:
"there's a bug in my code"
Stack trace:
bug
#m67hcdcoda

View File

@ -97,6 +97,7 @@ unique type RuntimeError =
The program halted with an unhandled exception:
Failure (typeLink RuntimeError) "oh noes!" (Any ())
Stack trace:
##raise