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 :: ToResponseCode a => 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 :: ToResponseCode a => a -> Reason a Source
Wrap your custom error type in a Reason
.
This requires the ToResponseCode dictionary to pick a response code when
the error is served.