Skip to content

Commit f5ed93c

Browse files
committed
refactor(Cabal): add a stack trace to dieProgress
1 parent 039e6e8 commit f5ed93c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Cabal/src/Distribution/Utils/LogProgress.hs

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

2324
type CtxMsg = Doc
@@ -87,10 +88,14 @@ 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
96+
[ formatMsg (le_context env) s
97+
, text (prettyCallStack callStack)
98+
]
9499

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

0 commit comments

Comments
 (0)