Safe Haskell | None |
---|---|
Language | Haskell2010 |
As name suggests few utilities to make life easier
Synopsis
- errText :: ServerError -> ByteString -> ServerError
- throwErrText :: MonadThrow u => ServerError -> ByteString -> u a
- throwUnauthorized :: MonadThrow u => u a
- jsonErrorFormatter :: ErrorFormatter
- notFoundFormatter :: NotFoundErrorFormatter
- askObj :: (Has β α, MonadReader α μ) => μ β
- askOpt :: (Has β α, MonadReader α μ) => (β -> ψ) -> μ ψ
Documentation
errText :: ServerError -> ByteString -> ServerError Source #
Construct plain ServerError Type with given status code and error text
throwErrText :: MonadThrow u => ServerError -> ByteString -> u a Source #
Creates and throws a simple text/plain ServerError.
throwUnauthorized :: MonadThrow u => u a Source #
Throws Unauthorized error
jsonErrorFormatter :: ErrorFormatter Source #
Custom JSON payload error formatter
notFoundFormatter :: NotFoundErrorFormatter Source #
Custom JSON payload error formatter for 404
askObj :: (Has β α, MonadReader α μ) => μ β Source #
Gets a value of any type from the context.
askOpt :: (Has β α, MonadReader α μ) => (β -> ψ) -> μ ψ Source #
Gets a thing from a value of any type from the context. (Useful for configuration fields.)