wai-routing-0.1: src/Network/Wai/Routing/Error.hs
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
module Network.Wai.Routing.Error where
import Data.ByteString (ByteString)
import Network.HTTP.Types.Status
-- | The error type used as meta-data for @F@ in all WAI predicates.
data Error = Error
{ status :: !Status -- ^ HTTP status code
, message :: Maybe ByteString -- ^ optional status message
} deriving (Eq, Show)
-- | Convenience function to construct 'Error' values from
-- status code and body message.
err :: Status -> ByteString -> Error
err s = Error s . Just