Add print stacktrace to exception handler in runtime system
main :: IO ()
main = do
someIO
putStrLn "hello world"
someIO :: IO ()
someIO = ioError $ IOError Nothing IllegalOperation "a" "b" Nothing Nothing
This code prints the following
exception: a: illegal operation (b)
I think there is something in the runtime system which takes this exception and prints this text to the terminal. I will call this the "runtime exception handler" (for i don't know any better).
main :: IO ()
main = do
ex <- try someIO :: IO (Either IOException ())
case ex of
Left e -> error (show e)
Right _ -> putStrLn "hello world"
someIO :: IO ()
someIO = ioError $ IOError Nothing IllegalOperation "a" "b" Nothing Nothing
output:
exception: a: illegal operation (b)
CallStack (from HasCallStack):
error, called at src/Main.hs:10:15 in main:Main
Now i use an explicit handler in my code and show the stacktrace with error
. Could this handler be moved into the RTS so that i can stacktraces with exceptions just like with error?
I think this issue is related to, but not the same as #12096 Because "Attach stacktrace information to SomeException" -- whatever there is being attached right now (with lts-10.2 ghc 8.2.2) is good enough to provide the information, it's just the print option in the handler that seems to be missing.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |