rest-core-0.33.1: Rest API library.

Safe HaskellNone

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') -> ErrorT e m a -> ErrorT e' m aSource

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

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

eitherToStatus :: Either a b -> Status a bSource

domainReason :: ToResponseCode a => a -> Reason aSource

Wrap your custom error type in a Reason. This requires the ToResponseCode dictionary to pick a response code when the error is served.