Safe Haskell | None |
---|---|
Language | Haskell98 |
Error types that can be returned by handlers, as well as some utilities for manipulating these errors.
- module Rest.Types.Error
- mapE :: (Applicative m, Monad m) => (e -> e') -> ErrorT e m a -> ErrorT e' m a
- orThrow :: MonadError e m => m (Maybe b) -> e -> m b
- orThrowWith :: MonadError a m => m (Either e b) -> (e -> a) -> m b
- eitherToStatus :: Either a b -> Status a b
- domainReason :: (a -> Int) -> a -> Reason a
Documentation
module Rest.Types.Error
orThrow :: MonadError e m => m (Maybe b) -> e -> m b Source
orThrowWith :: MonadError a m => m (Either e b) -> (e -> a) -> m b Source
eitherToStatus :: Either a b -> Status a b Source
domainReason :: (a -> Int) -> a -> Reason a Source
Wrap your custom error type in a Reason
. The first argument is
a function for converting your error to an HTTP status code.