Skip to content

Add exception type to messaged displayed by default exception handler #231

Closed
@tomjaguarpaw

Description

@tomjaguarpaw

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    approvedApproved by CLC votebase-4.21Implemented in base-4.21 (GHC 9.12)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions