| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Servant.Server.Internal.ErrorFormatter
Synopsis
- data ErrorFormatters = ErrorFormatters {}
 - type ErrorFormatter = TypeRep -> Request -> String -> ServerError
 - type NotFoundErrorFormatter = Request -> ServerError
 - type DefaultErrorFormatters = '[ErrorFormatters]
 - defaultErrorFormatters :: ErrorFormatters
 - type MkContextWithErrorFormatter (ctx :: [*]) = ctx .++ DefaultErrorFormatters
 - mkContextWithErrorFormatter :: forall (ctx :: [*]). Context ctx -> Context (MkContextWithErrorFormatter ctx)
 
Documentation
data ErrorFormatters Source #
A collection of error formatters for different situations.
If you need to override one of them, use defaultErrorFormatters with record update syntax.
Constructors
| ErrorFormatters | |
Fields 
  | |
type ErrorFormatter = TypeRep -> Request -> String -> ServerError Source #
A custom formatter for errors produced by parsing combinators like
 ReqBody or Capture.
A TypeRep argument described the concrete combinator that raised
 the error, allowing formatter to customize the message for different
 combinators.
A full Request is also passed so that the formatter can react to Accept header,
 for example.
type NotFoundErrorFormatter = Request -> ServerError Source #
This formatter does not get neither TypeRep nor error message.
type DefaultErrorFormatters = '[ErrorFormatters] Source #
Context that contains default error formatters.
defaultErrorFormatters :: ErrorFormatters Source #
Default formatters will just return HTTP 400 status code with error message as response body.
type MkContextWithErrorFormatter (ctx :: [*]) = ctx .++ DefaultErrorFormatters Source #
mkContextWithErrorFormatter :: forall (ctx :: [*]). Context ctx -> Context (MkContextWithErrorFormatter ctx) Source #