melf-1.3.1: An Elf parser
Copyright(c) Aleksey Makarov 2021
LicenseBSD 3-Clause License
Maintaineraleksey.makarov@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Control.Exception.ChainedException

Description

Exception that keeps the stack of error locations.

Synopsis

Documentation

data ChainedExceptionNext Source #

Structure to organize the stack of exceptions with locations

Constructors

Null

exception was initiated by chainedError

Next SomeException

some context was added to SomeException by addContext

NextChained ChainedException

some context was added to a ChainedException by addContext

data ChainedException Source #

Exception that keeps track of error locations

Constructors

ChainedException 

Fields

chainedError :: Q Exp Source #

$chainedError results in a function of type 'chainedError :: MonadThrow m => String -> m a'. It throws ChainedException with its argument as error description.

chainedError' :: Q Exp Source #

$chainedError' is the same as $chainedError ""

addContext :: Q Exp Source #

$addContext results in a function of type 'addContext :: MonadCatch m => String -> m a -> m a'. It runs the second argument and adds ChainedException with its first argument to the exceptions thrown from that monad.

addContext' :: Q Exp Source #

$addContext' is the same as $addContext ""

maybeAddContext :: Q Exp Source #

$maybeAddContext results in a function of type 'maybeAddContext :: MonadThrow m => String -> Maybe a -> m a'. If its second argument is Nothing, it throws ChainedException with its first argument, else it returns the value of Just.

maybeAddContext' :: Q Exp Source #

$maybeAddContext' is the same as $maybeAddContext ""

eitherAddContext' :: Q Exp Source #

$eitherAddContext' results in a function of type 'eitherAddContext' :: MonadThrow m => Either String a -> m a'. If its argument is Left e, it throws ChainedException with e as error description, else it returns the value of Right.