{-# LANGUAGE DeriveAnyClass #-}

module Hercules.API.Error where

import Hercules.API.Prelude

-- | General error type used in (some) HTTP error response bodies and in some
-- resources.
data Error = Error
  { -- | Symbolic names of the error condition; identifiers that clients
    -- may use to identify specific errors or classes of errors.
    Error -> [Text]
errorTags :: [Text],
    -- | Human-readable error message.
    Error -> Text
message :: Text
  }
  deriving (forall x. Rep Error x -> Error
forall x. Error -> Rep Error x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Error x -> Error
$cfrom :: forall x. Error -> Rep Error x
Generic, Int -> Error -> ShowS
[Error] -> ShowS
Error -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Error] -> ShowS
$cshowList :: [Error] -> ShowS
show :: Error -> String
$cshow :: Error -> String
showsPrec :: Int -> Error -> ShowS
$cshowsPrec :: Int -> Error -> ShowS
Show, Error -> Error -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Error -> Error -> Bool
$c/= :: Error -> Error -> Bool
== :: Error -> Error -> Bool
$c== :: Error -> Error -> Bool
Eq, Error -> ()
forall a. (a -> ()) -> NFData a
rnf :: Error -> ()
$crnf :: Error -> ()
NFData, [Error] -> Encoding
[Error] -> Value
Error -> Encoding
Error -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Error] -> Encoding
$ctoEncodingList :: [Error] -> Encoding
toJSONList :: [Error] -> Value
$ctoJSONList :: [Error] -> Value
toEncoding :: Error -> Encoding
$ctoEncoding :: Error -> Encoding
toJSON :: Error -> Value
$ctoJSON :: Error -> Value
ToJSON, Value -> Parser [Error]
Value -> Parser Error
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Error]
$cparseJSONList :: Value -> Parser [Error]
parseJSON :: Value -> Parser Error
$cparseJSON :: Value -> Parser Error
FromJSON, Proxy Error -> Declare (Definitions Schema) NamedSchema
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
declareNamedSchema :: Proxy Error -> Declare (Definitions Schema) NamedSchema
$cdeclareNamedSchema :: Proxy Error -> Declare (Definitions Schema) NamedSchema
ToSchema)