Skip to content

Commit eab5a10

Browse files
committed
refactor(Cabal): add a stack trace to dieProgress
1 parent aff15c3 commit eab5a10

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
@@ -19,6 +19,7 @@ import Prelude ()
1919
import Distribution.Simple.Utils
2020
import Distribution.Utils.Progress
2121
import Distribution.Verbosity
22+
import GHC.Stack (HasCallStack, callStack, prettyCallStack)
2223
import Text.PrettyPrint
2324

2425
type CtxMsg = Doc
@@ -88,10 +89,14 @@ infoProgress s = LogProgress $ \env ->
8889
stepProgress s
8990

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

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

0 commit comments

Comments
 (0)