module Database.Redis.IO.Types where
import Control.Exception (Exception, SomeException, catch)
import Data.Typeable
newtype Milliseconds = Ms { ms :: Int } deriving (Eq, Show, Num)
data ConnectionError
= ConnectionsBusy
| ConnectionClosed
| ConnectTimeout
deriving Typeable
instance Exception ConnectionError
instance Show ConnectionError where
show ConnectionsBusy = "Network.Redis.IO.ConnectionsBusy"
show ConnectionClosed = "Network.Redis.IO.ConnectionClosed"
show ConnectTimeout = "Network.Redis.IO.ConnectTimeout"
newtype InternalError = InternalError String
deriving Typeable
instance Exception InternalError
instance Show InternalError where
show (InternalError e) = "Network.Redis.IO.InternalError: " ++ show e
newtype Timeout = Timeout String
deriving Typeable
instance Exception Timeout
instance Show Timeout where
show (Timeout e) = "Network.Redis.IO.Timeout: " ++ e
ignore :: IO () -> IO ()
ignore a = catch a (const $ return () :: SomeException -> IO ())