module Network.Pushover.Exceptions where
import Control.Monad.Catch
import Control.Monad.Error.Class
import Control.Monad.Except
import Data.Typeable
data PushoverException
= ResponseDecodeException
| InvalidTokenCharactersException
| InvalidTokenLengthException
| PushoverException String
deriving (Show, Typeable)
instance Exception PushoverException
instance Error PushoverException where
noMsg =
PushoverException "Unknown exception"
strMsg =
PushoverException
errorMessage :: PushoverException -> String
errorMessage InvalidTokenLengthException =
"token must be exactly 30 characters long"
errorMessage InvalidTokenCharactersException =
"token must contain only alphanumeric characters"
errorMessage ResponseDecodeException =
"unexpected format of Pushover response"