| Copyright | (c) The University of Glasgow 1998-2002 |
|---|---|
| License | see libraries/base/LICENSE |
| Maintainer | cvs-ghc@haskell.org |
| Stability | internal |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
GHC.Internal.Exception.Context
Description
Exception context type.
Synopsis
- data ExceptionContext = ExceptionContext [SomeExceptionAnnotation]
- emptyExceptionContext :: ExceptionContext
- addExceptionAnnotation :: ExceptionAnnotation a => a -> ExceptionContext -> ExceptionContext
- getExceptionAnnotations :: ExceptionAnnotation a => ExceptionContext -> [a]
- getAllExceptionAnnotations :: ExceptionContext -> [SomeExceptionAnnotation]
- mergeExceptionContext :: ExceptionContext -> ExceptionContext -> ExceptionContext
- displayExceptionContext :: ExceptionContext -> String
- data SomeExceptionAnnotation = ExceptionAnnotation a => SomeExceptionAnnotation a
- class Typeable a => ExceptionAnnotation a where
- displayExceptionAnnotation :: a -> String
Exception context
data ExceptionContext #
Exception context represents a list of ExceptionAnnotations. These are
attached to SomeExceptions via addExceptionContext and
can be used to capture various ad-hoc metadata about the exception including
backtraces and application-specific context.
ExceptionContexts can be merged via concatenation using the Semigroup
instance or mergeExceptionContext.
Note that GHC will automatically solve implicit constraints of type ExceptionContext
with emptyExceptionContext.
Constructors
| ExceptionContext [SomeExceptionAnnotation] |
Instances
| Monoid ExceptionContext # | |
Defined in GHC.Internal.Exception.Context Methods mappend :: ExceptionContext -> ExceptionContext -> ExceptionContext # mconcat :: [ExceptionContext] -> ExceptionContext # | |
| Semigroup ExceptionContext # | |
Defined in GHC.Internal.Exception.Context Methods (<>) :: ExceptionContext -> ExceptionContext -> ExceptionContext # sconcat :: NonEmpty ExceptionContext -> ExceptionContext # stimes :: Integral b => b -> ExceptionContext -> ExceptionContext # | |
emptyExceptionContext :: ExceptionContext #
An ExceptionContext containing no annotations.
Since: base-4.20.0.0
addExceptionAnnotation :: ExceptionAnnotation a => a -> ExceptionContext -> ExceptionContext #
Construct a singleton ExceptionContext from an ExceptionAnnotation.
Since: base-4.20.0.0
getExceptionAnnotations :: ExceptionAnnotation a => ExceptionContext -> [a] #
Retrieve all ExceptionAnnotations of the given type from an ExceptionContext.
Since: base-4.20.0.0
mergeExceptionContext :: ExceptionContext -> ExceptionContext -> ExceptionContext #
Merge two ExceptionContexts via concatenation
Since: base-4.20.0.0
displayExceptionContext :: ExceptionContext -> String #
Render ExceptionContext to a human-readable String.
Since: base-4.20.0.0
Exception annotations
data SomeExceptionAnnotation #
Constructors
| ExceptionAnnotation a => SomeExceptionAnnotation a |
class Typeable a => ExceptionAnnotation a where #
ExceptionAnnotations are types which can decorate exceptions as
ExceptionContext.
Since: base-4.20.0.0
Minimal complete definition
Nothing
Methods
displayExceptionAnnotation :: a -> String #
Render the annotation for display to the user.
default displayExceptionAnnotation :: Show a => a -> String #
Instances
| ExceptionAnnotation Backtraces # | |
Defined in GHC.Internal.Exception.Backtrace Methods | |
| ExceptionAnnotation WhileHandling # | |
Defined in GHC.Internal.Exception.Type Methods | |