-- |Sum type for any error conditions in a API request.
module Cryptsy.API.Public.Types.Error where

-- HTTP
import Network.HTTP.Base (Response)

-- aeson
import Data.Aeson (Value)

-- bytestring
import Data.ByteString.Lazy (ByteString)

-- |error conditions w/ debugging information for an API request
data CryptsyError = BadURL { badURL :: String }
                  | BadResponse { badResponse :: Response ByteString }
                  | FailParseResponse { responseBody :: ByteString, errorMessage :: String }
                  | ErrorResponse { errorValue :: Value }
                  | UnsuccessfulResponse { jsonResponse :: Value }
                  | FailParseReturn { dataValue :: Value, errorMessage :: String }
                  deriving Show