#if MIN_VERSION_base(4,9,0)
#endif
module Bluetooth.Internal.Errors where
import Control.Monad.Except
import qualified Data.Text as T
import GHC.Generics (Generic)
newtype Handler a
= Handler { getReadValue :: ExceptT T.Text IO a }
deriving (Functor, Applicative, Monad, MonadIO, Generic, MonadError T.Text)
runHandler :: Handler a -> IO (Either T.Text a)
runHandler = runExceptT . getReadValue
errorFailed :: Handler a
errorFailed = throwError "org.bluez.Error.Failed"
errorInProgress :: Handler a
errorInProgress = throwError "org.bluez.Error.InProgress"
errorNotPermitted :: Handler a
errorNotPermitted = throwError "org.bluez.Error.NotPermitted"
errorNotAuthorized :: Handler a
errorNotAuthorized = throwError "org.bluez.Error.NotAuthorized"
errorNotSupported :: Handler a
errorNotSupported = throwError "org.bluez.Error.NotSupported"
errorInvalidValueLength :: Handler a
errorInvalidValueLength = throwError "org.bluez.Error.InvalidValueLength"