chakra-0.1.0: A REST Web Api server template for building (micro)services.
Safe HaskellNone
LanguageHaskell2010

Chakra.Util

Description

As name suggests few utilities to make life easier

Synopsis

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.)