Skip to content

HasCallStack from `errorCallWithCallStackException` are not propagated to exception backtraces

Consider the following program:

main = error "hi"

One would expect that the backtrace attached to the thrown exception describes the call to error. However, sadly this is not the case:

$ ./Test
Test: hi
CallStack (from HasCallStack):
  error, called at Test.hs:1:8 in main:Main
HasCallStack backtrace:
  collectBacktraces, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:92:13 in ghc-internal:GHC.Internal.Exception
  toExceptionWithBacktrace, called at libraries/ghc-internal/src/GHC/Internal/Exception.hs:128:3 in ghc-internal:GHC.Internal.Exception
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information