rest-core-0.39: Rest API library.

Safe HaskellNone
LanguageHaskell98

Rest.Error

Description

Error types that can be returned by handlers, as well as some utilities for manipulating these errors.

Synopsis

Documentation

mapE :: (Applicative m, Monad m) => (e -> e') -> ExceptT e m a -> ExceptT e' m a infixl 8 Source #

orThrow :: MonadError e m => m (Maybe b) -> e -> m b Source #

orThrowWith :: MonadError a m => m (Either e b) -> (e -> a) -> m b Source #

domainReason :: a -> Reason a Source #

Wrap your custom error type in a Reason.

(>|<) :: Monad m => ExceptT f m a -> ExceptT e m a -> ExceptT e m a infixl 3 Source #

Try two ExceptT computations left to right yielding the last error if both fail. This prevents the need for a Semigroup or Monoid instance for the error type, which is necessary if using (!) or (|) respectively.