Safe Haskell | None |
---|---|
Language | Haskell2010 |
Util.Exception
Synopsis
- throwLeft :: (MonadThrow m, Exception e) => m (Either e a) -> m a
- data TextException = TextException Text
- newtype DisplayExceptionInShow = DisplayExceptionInShow {}
- displayUncaughtException :: IO () -> IO ()
General simple helpers
throwLeft :: (MonadThrow m, Exception e) => m (Either e a) -> m a Source #
If monadic action returns a Left
value, it will be
thrown. Otherwise the returned value will be returned as is.
Common exceptions
data TextException Source #
Constructors
TextException Text |
Instances
Show TextException Source # | |
Defined in Util.Exception Methods showsPrec :: Int -> TextException -> ShowS # show :: TextException -> String # showList :: [TextException] -> ShowS # | |
Exception TextException Source # | |
Defined in Util.Exception Methods toException :: TextException -> SomeException # fromException :: SomeException -> Maybe TextException # displayException :: TextException -> String # | |
Buildable TextException Source # | |
Defined in Util.Exception Methods build :: TextException -> Builder # |
Better printing of exceptions
newtype DisplayExceptionInShow Source #
Constructors
DisplayExceptionInShow | |
Fields |
Instances
Show DisplayExceptionInShow Source # | |
Defined in Util.Exception Methods showsPrec :: Int -> DisplayExceptionInShow -> ShowS # show :: DisplayExceptionInShow -> String # showList :: [DisplayExceptionInShow] -> ShowS # | |
Exception DisplayExceptionInShow Source # | |
Defined in Util.Exception |
displayUncaughtException :: IO () -> IO () Source #
Customise default uncaught exception handling. The problem with
the default handler is that it uses show
to display uncaught
exceptions, but displayException
may provide more reasonable
output. We do not modify uncaught exception handler, but simply
wrap uncaught exceptions (only synchronous ones) into
DisplayExceptionInShow
.
Some exceptions (currently we are aware only of ExitCode
) are
handled specially by default exception handler, so we don't wrap
them.