Description
When an exception is printed by the default exception handler (through its show
method, as it is now, or through its displayException
, as it will be after #198), it can be hard to know what type the exception is (and therefore how one should catch
it) or even that it is an exception at all. For example, it took me until about six months ago to even realize that the follow message was indicative of an uncaught exception, and it could be handled and recovered from. I thought it was an unrecoverable RTS error condition!
myprog: thread blocked indefinitely in an MVar operation
It would have been much more helpful to me if the message had been
myprog: thread blocked indefinitely in an MVar operation
Exception type: BlockedIndefinitelyOnMVar
Therefore I propose to add display of show (typeOf exn)
to the default exception handler (defaultHandler
in GHC/Conc/Sync.hs
).
The proposed implementation is by @tbidne, at https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11737 (which also adds package and module name information to the displayed message)