homepage: https://github.com/mtesseract/error-context#readme
changelog-type: markdown
hash: 8bb64433b0a617cc08288d4cb6efdffcefdfa753071cc5c9470e5c4fd976dbeb
test-bench-deps:
  exceptions: -any
  either: -any
  base: ! '>=4.7 && <5'
  text: -any
  safe-exceptions: -any
  unliftio-core: -any
  error-context: -any
  mtl: -any
  tasty-hunit: -any
  monad-logger: -any
  tasty: -any
  resourcet: -any
maintainer: mtesseract@silverratio.net
synopsis: Provides API for enriching errors with contexts
changelog: ! '# Changelog for error-context


  ## Unreleased changes

'
basic-deps:
  exceptions: -any
  either: -any
  base: ! '>=4.7 && <5'
  text: -any
  safe-exceptions: -any
  unliftio-core: -any
  mtl: -any
  monad-logger: -any
  resourcet: -any
all-versions:
- '0.1.0.0'
author: Moritz Clasmeier
latest: '0.1.0.0'
description-type: markdown
description: ! '# !! This is experimental work-in-progress !!


  Welcome to *error-context*! This is a library providing context-aware

  error and exception handling for Haskell.


  ## What problem does *error-context* attempt to solve?


  Good error handling is hard. Sometimes it happens that when

  propagating errors some context is lost. Call traces sometimes help,

  but the current solutions in Haskell-land for accessing call traces

  are rather limited. Furthermore, sometimes call traces that at written

  by and for humans are more convenient to read.


  The *error-context* library allows you to easily attach call traces

  (''error contexts'') to errors, in particular to exceptions. Special

  catch-functions are provided for accessing these contexts.


  ## How to use it?


  Add an `ErrorContextT` layer to your monad transformer stack by adding

  `runErrorContextT` to the transformer unwrapping code.


  The `ErrorContextT` transformer provides the context-enriching logic

  via special implementations of `MonadThrow`, `MonadCatch` and

  `MonadIO`.


  ## Examples


  See https://github.com/mtesseract/error-context/blob/master/test/Control/Error/Context/Test.hs.


  ## What about "pure" exceptions?


  The `ErrorContextT` transformer implements `MonadThrow` and `MonadIO`,

  therefore exceptions thrown by `throwM` and via `liftIO` are

  automatically context-enriched. But the story for exceptional values

  created via


  ```haskell

  throw :: Exception e => e -> a

  ```


  are not context-enriched. But there is a workaround for this use-case:


  ```haskell

  ensureExceptionContext :: (MonadCatch m, MonadErrorContext m) => m a -> m a

  ```


  This function provides context-aware enriching for any exceptions

  thrown within some monadic value, including those thrown by evaluating

  values created by `throw`.

'
license-name: BSD3

Update from Hackage at 2018-04-01T12:43:56Z
Update from Hackage at 2018-04-01T12:43:56Z
