Skip to content

Commit c196779

Browse files
committed
refactor(Cabal): add a stack trace to dieProgress
1 parent 00f1303 commit c196779

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Cabal/src/Distribution/Utils/LogProgress.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Distribution.Simple.Utils
1919
import Distribution.Utils.Progress
2020
import Distribution.Verbosity
2121
import Text.PrettyPrint
22+
import GHC.Stack (HasCallStack, callStack, prettyCallStack)
2223

2324
type CtxMsg = Doc
2425
type LogMsg = Doc
@@ -87,10 +88,13 @@ infoProgress s = LogProgress $ \env ->
8788
stepProgress s
8889

8990
-- | Fail the computation with an error message.
90-
dieProgress :: Doc -> LogProgress a
91+
dieProgress :: HasCallStack => Doc -> LogProgress a
9192
dieProgress s = LogProgress $ \env ->
9293
failProgress $
93-
hang (text "Error:") 4 (formatMsg (le_context env) s)
94+
hang (text "Error:") 4 $
95+
vcat [ formatMsg (le_context env) s
96+
, text (prettyCallStack callStack)
97+
]
9498

9599
-- | Format a message with context. (Something simple for now.)
96100
formatMsg :: [CtxMsg] -> Doc -> Doc

0 commit comments

Comments
 (0)