{-# LANGUAGE DerivingVia #-}
module Botan.Low.Error.Internal (
BotanErrorCode
, botanErrorDescription
, BotanErrorMessage(..)
, botanErrorLastExceptionMessage
, SomeBotanException(..)
, toBotanException
, fromBotanException
, InvalidInputException(..)
, BadMACException(..)
, InsufficientBufferSpaceException(..)
, StringConversionException(..)
, ExceptionThrownException(..)
, OutOfMemoryException(..)
, SystemErrorException(..)
, InternalErrorException(..)
, BadFlagException(..)
, NullPointerException(..)
, BadParameterException(..)
, KeyNotSetException(..)
, InvalidKeyLengthException(..)
, InvalidObjectStateException(..)
, NotImplementedException(..)
, InvalidObjectException(..)
, UnknownException(..)
, throwBotanError
, throwBotanIfNegative
, throwBotanIfNegative_
, throwBotanCatchingInvalidVerifier
, throwBotanCatchingInvalidInput
, throwBotanCatchingBool
, throwBotanCatching
, throwBotanErrorWithCallstack
) where
import Botan.Bindings.ConstPtr (ConstPtr (..))
import Botan.Bindings.Error
import Botan.Low.Internal.ByteString
import Control.Exception
import Control.Monad
import Data.ByteString (ByteString)
import Data.Typeable
import Foreign.C.Types
import GHC.Stack
import Prelude
newtype BotanErrorCode = BotanErrorCode CInt
deriving stock (Int -> BotanErrorCode -> ShowS
[BotanErrorCode] -> ShowS
BotanErrorCode -> String
(Int -> BotanErrorCode -> ShowS)
-> (BotanErrorCode -> String)
-> ([BotanErrorCode] -> ShowS)
-> Show BotanErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotanErrorCode -> ShowS
showsPrec :: Int -> BotanErrorCode -> ShowS
$cshow :: BotanErrorCode -> String
show :: BotanErrorCode -> String
$cshowList :: [BotanErrorCode] -> ShowS
showList :: [BotanErrorCode] -> ShowS
Show, BotanErrorCode -> BotanErrorCode -> Bool
(BotanErrorCode -> BotanErrorCode -> Bool)
-> (BotanErrorCode -> BotanErrorCode -> Bool) -> Eq BotanErrorCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotanErrorCode -> BotanErrorCode -> Bool
== :: BotanErrorCode -> BotanErrorCode -> Bool
$c/= :: BotanErrorCode -> BotanErrorCode -> Bool
/= :: BotanErrorCode -> BotanErrorCode -> Bool
Eq)
botanErrorDescription :: BotanErrorCode -> IO ByteString
botanErrorDescription :: BotanErrorCode -> IO ByteString
botanErrorDescription (BotanErrorCode CInt
e) = do
ConstPtr CChar
descPtr <- CInt -> IO (ConstPtr CChar)
botan_error_description CInt
e
CString -> IO ByteString
peekCString ConstPtr CChar
descPtr.unConstPtr
newtype BotanErrorMessage = BotanErrorMessage ByteString
deriving newtype Int -> BotanErrorMessage -> ShowS
[BotanErrorMessage] -> ShowS
BotanErrorMessage -> String
(Int -> BotanErrorMessage -> ShowS)
-> (BotanErrorMessage -> String)
-> ([BotanErrorMessage] -> ShowS)
-> Show BotanErrorMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotanErrorMessage -> ShowS
showsPrec :: Int -> BotanErrorMessage -> ShowS
$cshow :: BotanErrorMessage -> String
show :: BotanErrorMessage -> String
$cshowList :: [BotanErrorMessage] -> ShowS
showList :: [BotanErrorMessage] -> ShowS
Show
botanErrorLastExceptionMessage :: IO BotanErrorMessage
botanErrorLastExceptionMessage :: IO BotanErrorMessage
botanErrorLastExceptionMessage = do
ConstPtr CChar
msgPtr <- IO (ConstPtr CChar)
botan_error_last_exception_message
ByteString -> BotanErrorMessage
BotanErrorMessage (ByteString -> BotanErrorMessage)
-> IO ByteString -> IO BotanErrorMessage
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> CString -> IO ByteString
peekCString ConstPtr CChar
msgPtr.unConstPtr
data SomeBotanException = forall e . Exception e => SomeBotanException e
instance Show SomeBotanException where
show :: SomeBotanException -> String
show (SomeBotanException e
e) = e -> String
forall a. Show a => a -> String
show e
e
instance Exception SomeBotanException
toBotanException :: Exception e => e -> SomeException
toBotanException :: forall e. Exception e => e -> SomeException
toBotanException = SomeBotanException -> SomeException
forall e. Exception e => e -> SomeException
toException (SomeBotanException -> SomeException)
-> (e -> SomeBotanException) -> e -> SomeException
forall b c a. (b -> c) -> (a -> b) -> a -> c
. e -> SomeBotanException
forall e. Exception e => e -> SomeBotanException
SomeBotanException
fromBotanException :: Exception e => SomeException -> Maybe e
fromBotanException :: forall e. Exception e => SomeException -> Maybe e
fromBotanException SomeException
x = do
SomeBotanException e
a <- SomeException -> Maybe SomeBotanException
forall e. Exception e => SomeException -> Maybe e
fromException SomeException
x
e -> Maybe e
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast e
a
newtype ViaSomeBotanException e = ViaSomeBotanException e
deriving stock Int -> ViaSomeBotanException e -> ShowS
[ViaSomeBotanException e] -> ShowS
ViaSomeBotanException e -> String
(Int -> ViaSomeBotanException e -> ShowS)
-> (ViaSomeBotanException e -> String)
-> ([ViaSomeBotanException e] -> ShowS)
-> Show (ViaSomeBotanException e)
forall e. Show e => Int -> ViaSomeBotanException e -> ShowS
forall e. Show e => [ViaSomeBotanException e] -> ShowS
forall e. Show e => ViaSomeBotanException e -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall e. Show e => Int -> ViaSomeBotanException e -> ShowS
showsPrec :: Int -> ViaSomeBotanException e -> ShowS
$cshow :: forall e. Show e => ViaSomeBotanException e -> String
show :: ViaSomeBotanException e -> String
$cshowList :: forall e. Show e => [ViaSomeBotanException e] -> ShowS
showList :: [ViaSomeBotanException e] -> ShowS
Show
instance (Show e, Typeable e) => Exception (ViaSomeBotanException e) where
toException :: ViaSomeBotanException e -> SomeException
toException = ViaSomeBotanException e -> SomeException
forall e. Exception e => e -> SomeException
toBotanException
fromException :: SomeException -> Maybe (ViaSomeBotanException e)
fromException = SomeException -> Maybe (ViaSomeBotanException e)
forall e. Exception e => SomeException -> Maybe e
fromBotanException
data InvalidVerifierException
= InvalidVerifierException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InvalidVerifierException -> ShowS
[InvalidVerifierException] -> ShowS
InvalidVerifierException -> String
(Int -> InvalidVerifierException -> ShowS)
-> (InvalidVerifierException -> String)
-> ([InvalidVerifierException] -> ShowS)
-> Show InvalidVerifierException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvalidVerifierException -> ShowS
showsPrec :: Int -> InvalidVerifierException -> ShowS
$cshow :: InvalidVerifierException -> String
show :: InvalidVerifierException -> String
$cshowList :: [InvalidVerifierException] -> ShowS
showList :: [InvalidVerifierException] -> ShowS
Show)
deriving Show InvalidVerifierException
Typeable InvalidVerifierException
(Typeable InvalidVerifierException,
Show InvalidVerifierException) =>
(InvalidVerifierException -> SomeException)
-> (SomeException -> Maybe InvalidVerifierException)
-> (InvalidVerifierException -> String)
-> Exception InvalidVerifierException
SomeException -> Maybe InvalidVerifierException
InvalidVerifierException -> String
InvalidVerifierException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InvalidVerifierException -> SomeException
toException :: InvalidVerifierException -> SomeException
$cfromException :: SomeException -> Maybe InvalidVerifierException
fromException :: SomeException -> Maybe InvalidVerifierException
$cdisplayException :: InvalidVerifierException -> String
displayException :: InvalidVerifierException -> String
Exception via ViaSomeBotanException InvalidVerifierException
data InvalidInputException
= InvalidInputException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InvalidInputException -> ShowS
[InvalidInputException] -> ShowS
InvalidInputException -> String
(Int -> InvalidInputException -> ShowS)
-> (InvalidInputException -> String)
-> ([InvalidInputException] -> ShowS)
-> Show InvalidInputException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvalidInputException -> ShowS
showsPrec :: Int -> InvalidInputException -> ShowS
$cshow :: InvalidInputException -> String
show :: InvalidInputException -> String
$cshowList :: [InvalidInputException] -> ShowS
showList :: [InvalidInputException] -> ShowS
Show)
deriving Show InvalidInputException
Typeable InvalidInputException
(Typeable InvalidInputException, Show InvalidInputException) =>
(InvalidInputException -> SomeException)
-> (SomeException -> Maybe InvalidInputException)
-> (InvalidInputException -> String)
-> Exception InvalidInputException
SomeException -> Maybe InvalidInputException
InvalidInputException -> String
InvalidInputException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InvalidInputException -> SomeException
toException :: InvalidInputException -> SomeException
$cfromException :: SomeException -> Maybe InvalidInputException
fromException :: SomeException -> Maybe InvalidInputException
$cdisplayException :: InvalidInputException -> String
displayException :: InvalidInputException -> String
Exception via ViaSomeBotanException InvalidInputException
data BadMACException
= BadMACException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> BadMACException -> ShowS
[BadMACException] -> ShowS
BadMACException -> String
(Int -> BadMACException -> ShowS)
-> (BadMACException -> String)
-> ([BadMACException] -> ShowS)
-> Show BadMACException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BadMACException -> ShowS
showsPrec :: Int -> BadMACException -> ShowS
$cshow :: BadMACException -> String
show :: BadMACException -> String
$cshowList :: [BadMACException] -> ShowS
showList :: [BadMACException] -> ShowS
Show)
deriving Show BadMACException
Typeable BadMACException
(Typeable BadMACException, Show BadMACException) =>
(BadMACException -> SomeException)
-> (SomeException -> Maybe BadMACException)
-> (BadMACException -> String)
-> Exception BadMACException
SomeException -> Maybe BadMACException
BadMACException -> String
BadMACException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: BadMACException -> SomeException
toException :: BadMACException -> SomeException
$cfromException :: SomeException -> Maybe BadMACException
fromException :: SomeException -> Maybe BadMACException
$cdisplayException :: BadMACException -> String
displayException :: BadMACException -> String
Exception via ViaSomeBotanException BadMACException
data InsufficientBufferSpaceException
= InsufficientBufferSpaceException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InsufficientBufferSpaceException -> ShowS
[InsufficientBufferSpaceException] -> ShowS
InsufficientBufferSpaceException -> String
(Int -> InsufficientBufferSpaceException -> ShowS)
-> (InsufficientBufferSpaceException -> String)
-> ([InsufficientBufferSpaceException] -> ShowS)
-> Show InsufficientBufferSpaceException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InsufficientBufferSpaceException -> ShowS
showsPrec :: Int -> InsufficientBufferSpaceException -> ShowS
$cshow :: InsufficientBufferSpaceException -> String
show :: InsufficientBufferSpaceException -> String
$cshowList :: [InsufficientBufferSpaceException] -> ShowS
showList :: [InsufficientBufferSpaceException] -> ShowS
Show)
deriving Show InsufficientBufferSpaceException
Typeable InsufficientBufferSpaceException
(Typeable InsufficientBufferSpaceException,
Show InsufficientBufferSpaceException) =>
(InsufficientBufferSpaceException -> SomeException)
-> (SomeException -> Maybe InsufficientBufferSpaceException)
-> (InsufficientBufferSpaceException -> String)
-> Exception InsufficientBufferSpaceException
SomeException -> Maybe InsufficientBufferSpaceException
InsufficientBufferSpaceException -> String
InsufficientBufferSpaceException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InsufficientBufferSpaceException -> SomeException
toException :: InsufficientBufferSpaceException -> SomeException
$cfromException :: SomeException -> Maybe InsufficientBufferSpaceException
fromException :: SomeException -> Maybe InsufficientBufferSpaceException
$cdisplayException :: InsufficientBufferSpaceException -> String
displayException :: InsufficientBufferSpaceException -> String
Exception via ViaSomeBotanException InsufficientBufferSpaceException
data StringConversionException
= StringConversionException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> StringConversionException -> ShowS
[StringConversionException] -> ShowS
StringConversionException -> String
(Int -> StringConversionException -> ShowS)
-> (StringConversionException -> String)
-> ([StringConversionException] -> ShowS)
-> Show StringConversionException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StringConversionException -> ShowS
showsPrec :: Int -> StringConversionException -> ShowS
$cshow :: StringConversionException -> String
show :: StringConversionException -> String
$cshowList :: [StringConversionException] -> ShowS
showList :: [StringConversionException] -> ShowS
Show)
deriving Show StringConversionException
Typeable StringConversionException
(Typeable StringConversionException,
Show StringConversionException) =>
(StringConversionException -> SomeException)
-> (SomeException -> Maybe StringConversionException)
-> (StringConversionException -> String)
-> Exception StringConversionException
SomeException -> Maybe StringConversionException
StringConversionException -> String
StringConversionException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: StringConversionException -> SomeException
toException :: StringConversionException -> SomeException
$cfromException :: SomeException -> Maybe StringConversionException
fromException :: SomeException -> Maybe StringConversionException
$cdisplayException :: StringConversionException -> String
displayException :: StringConversionException -> String
Exception via ViaSomeBotanException StringConversionException
data ExceptionThrownException
= ExceptionThrownException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> ExceptionThrownException -> ShowS
[ExceptionThrownException] -> ShowS
ExceptionThrownException -> String
(Int -> ExceptionThrownException -> ShowS)
-> (ExceptionThrownException -> String)
-> ([ExceptionThrownException] -> ShowS)
-> Show ExceptionThrownException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExceptionThrownException -> ShowS
showsPrec :: Int -> ExceptionThrownException -> ShowS
$cshow :: ExceptionThrownException -> String
show :: ExceptionThrownException -> String
$cshowList :: [ExceptionThrownException] -> ShowS
showList :: [ExceptionThrownException] -> ShowS
Show)
deriving Show ExceptionThrownException
Typeable ExceptionThrownException
(Typeable ExceptionThrownException,
Show ExceptionThrownException) =>
(ExceptionThrownException -> SomeException)
-> (SomeException -> Maybe ExceptionThrownException)
-> (ExceptionThrownException -> String)
-> Exception ExceptionThrownException
SomeException -> Maybe ExceptionThrownException
ExceptionThrownException -> String
ExceptionThrownException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: ExceptionThrownException -> SomeException
toException :: ExceptionThrownException -> SomeException
$cfromException :: SomeException -> Maybe ExceptionThrownException
fromException :: SomeException -> Maybe ExceptionThrownException
$cdisplayException :: ExceptionThrownException -> String
displayException :: ExceptionThrownException -> String
Exception via ViaSomeBotanException ExceptionThrownException
data OutOfMemoryException
= OutOfMemoryException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> OutOfMemoryException -> ShowS
[OutOfMemoryException] -> ShowS
OutOfMemoryException -> String
(Int -> OutOfMemoryException -> ShowS)
-> (OutOfMemoryException -> String)
-> ([OutOfMemoryException] -> ShowS)
-> Show OutOfMemoryException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OutOfMemoryException -> ShowS
showsPrec :: Int -> OutOfMemoryException -> ShowS
$cshow :: OutOfMemoryException -> String
show :: OutOfMemoryException -> String
$cshowList :: [OutOfMemoryException] -> ShowS
showList :: [OutOfMemoryException] -> ShowS
Show)
deriving Show OutOfMemoryException
Typeable OutOfMemoryException
(Typeable OutOfMemoryException, Show OutOfMemoryException) =>
(OutOfMemoryException -> SomeException)
-> (SomeException -> Maybe OutOfMemoryException)
-> (OutOfMemoryException -> String)
-> Exception OutOfMemoryException
SomeException -> Maybe OutOfMemoryException
OutOfMemoryException -> String
OutOfMemoryException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: OutOfMemoryException -> SomeException
toException :: OutOfMemoryException -> SomeException
$cfromException :: SomeException -> Maybe OutOfMemoryException
fromException :: SomeException -> Maybe OutOfMemoryException
$cdisplayException :: OutOfMemoryException -> String
displayException :: OutOfMemoryException -> String
Exception via ViaSomeBotanException OutOfMemoryException
data SystemErrorException
= SystemErrorException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> SystemErrorException -> ShowS
[SystemErrorException] -> ShowS
SystemErrorException -> String
(Int -> SystemErrorException -> ShowS)
-> (SystemErrorException -> String)
-> ([SystemErrorException] -> ShowS)
-> Show SystemErrorException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SystemErrorException -> ShowS
showsPrec :: Int -> SystemErrorException -> ShowS
$cshow :: SystemErrorException -> String
show :: SystemErrorException -> String
$cshowList :: [SystemErrorException] -> ShowS
showList :: [SystemErrorException] -> ShowS
Show)
deriving Show SystemErrorException
Typeable SystemErrorException
(Typeable SystemErrorException, Show SystemErrorException) =>
(SystemErrorException -> SomeException)
-> (SomeException -> Maybe SystemErrorException)
-> (SystemErrorException -> String)
-> Exception SystemErrorException
SomeException -> Maybe SystemErrorException
SystemErrorException -> String
SystemErrorException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: SystemErrorException -> SomeException
toException :: SystemErrorException -> SomeException
$cfromException :: SomeException -> Maybe SystemErrorException
fromException :: SomeException -> Maybe SystemErrorException
$cdisplayException :: SystemErrorException -> String
displayException :: SystemErrorException -> String
Exception via ViaSomeBotanException SystemErrorException
data InternalErrorException
= InternalErrorException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InternalErrorException -> ShowS
[InternalErrorException] -> ShowS
InternalErrorException -> String
(Int -> InternalErrorException -> ShowS)
-> (InternalErrorException -> String)
-> ([InternalErrorException] -> ShowS)
-> Show InternalErrorException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InternalErrorException -> ShowS
showsPrec :: Int -> InternalErrorException -> ShowS
$cshow :: InternalErrorException -> String
show :: InternalErrorException -> String
$cshowList :: [InternalErrorException] -> ShowS
showList :: [InternalErrorException] -> ShowS
Show)
deriving Show InternalErrorException
Typeable InternalErrorException
(Typeable InternalErrorException, Show InternalErrorException) =>
(InternalErrorException -> SomeException)
-> (SomeException -> Maybe InternalErrorException)
-> (InternalErrorException -> String)
-> Exception InternalErrorException
SomeException -> Maybe InternalErrorException
InternalErrorException -> String
InternalErrorException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InternalErrorException -> SomeException
toException :: InternalErrorException -> SomeException
$cfromException :: SomeException -> Maybe InternalErrorException
fromException :: SomeException -> Maybe InternalErrorException
$cdisplayException :: InternalErrorException -> String
displayException :: InternalErrorException -> String
Exception via ViaSomeBotanException InternalErrorException
data BadFlagException
= BadFlagException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> BadFlagException -> ShowS
[BadFlagException] -> ShowS
BadFlagException -> String
(Int -> BadFlagException -> ShowS)
-> (BadFlagException -> String)
-> ([BadFlagException] -> ShowS)
-> Show BadFlagException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BadFlagException -> ShowS
showsPrec :: Int -> BadFlagException -> ShowS
$cshow :: BadFlagException -> String
show :: BadFlagException -> String
$cshowList :: [BadFlagException] -> ShowS
showList :: [BadFlagException] -> ShowS
Show)
deriving Show BadFlagException
Typeable BadFlagException
(Typeable BadFlagException, Show BadFlagException) =>
(BadFlagException -> SomeException)
-> (SomeException -> Maybe BadFlagException)
-> (BadFlagException -> String)
-> Exception BadFlagException
SomeException -> Maybe BadFlagException
BadFlagException -> String
BadFlagException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: BadFlagException -> SomeException
toException :: BadFlagException -> SomeException
$cfromException :: SomeException -> Maybe BadFlagException
fromException :: SomeException -> Maybe BadFlagException
$cdisplayException :: BadFlagException -> String
displayException :: BadFlagException -> String
Exception via ViaSomeBotanException BadFlagException
data NullPointerException
= NullPointerException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> NullPointerException -> ShowS
[NullPointerException] -> ShowS
NullPointerException -> String
(Int -> NullPointerException -> ShowS)
-> (NullPointerException -> String)
-> ([NullPointerException] -> ShowS)
-> Show NullPointerException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NullPointerException -> ShowS
showsPrec :: Int -> NullPointerException -> ShowS
$cshow :: NullPointerException -> String
show :: NullPointerException -> String
$cshowList :: [NullPointerException] -> ShowS
showList :: [NullPointerException] -> ShowS
Show)
deriving Show NullPointerException
Typeable NullPointerException
(Typeable NullPointerException, Show NullPointerException) =>
(NullPointerException -> SomeException)
-> (SomeException -> Maybe NullPointerException)
-> (NullPointerException -> String)
-> Exception NullPointerException
SomeException -> Maybe NullPointerException
NullPointerException -> String
NullPointerException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: NullPointerException -> SomeException
toException :: NullPointerException -> SomeException
$cfromException :: SomeException -> Maybe NullPointerException
fromException :: SomeException -> Maybe NullPointerException
$cdisplayException :: NullPointerException -> String
displayException :: NullPointerException -> String
Exception via ViaSomeBotanException NullPointerException
data BadParameterException
= BadParameterException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> BadParameterException -> ShowS
[BadParameterException] -> ShowS
BadParameterException -> String
(Int -> BadParameterException -> ShowS)
-> (BadParameterException -> String)
-> ([BadParameterException] -> ShowS)
-> Show BadParameterException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BadParameterException -> ShowS
showsPrec :: Int -> BadParameterException -> ShowS
$cshow :: BadParameterException -> String
show :: BadParameterException -> String
$cshowList :: [BadParameterException] -> ShowS
showList :: [BadParameterException] -> ShowS
Show)
deriving Show BadParameterException
Typeable BadParameterException
(Typeable BadParameterException, Show BadParameterException) =>
(BadParameterException -> SomeException)
-> (SomeException -> Maybe BadParameterException)
-> (BadParameterException -> String)
-> Exception BadParameterException
SomeException -> Maybe BadParameterException
BadParameterException -> String
BadParameterException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: BadParameterException -> SomeException
toException :: BadParameterException -> SomeException
$cfromException :: SomeException -> Maybe BadParameterException
fromException :: SomeException -> Maybe BadParameterException
$cdisplayException :: BadParameterException -> String
displayException :: BadParameterException -> String
Exception via ViaSomeBotanException BadParameterException
data KeyNotSetException
= KeyNotSetException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> KeyNotSetException -> ShowS
[KeyNotSetException] -> ShowS
KeyNotSetException -> String
(Int -> KeyNotSetException -> ShowS)
-> (KeyNotSetException -> String)
-> ([KeyNotSetException] -> ShowS)
-> Show KeyNotSetException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> KeyNotSetException -> ShowS
showsPrec :: Int -> KeyNotSetException -> ShowS
$cshow :: KeyNotSetException -> String
show :: KeyNotSetException -> String
$cshowList :: [KeyNotSetException] -> ShowS
showList :: [KeyNotSetException] -> ShowS
Show)
deriving Show KeyNotSetException
Typeable KeyNotSetException
(Typeable KeyNotSetException, Show KeyNotSetException) =>
(KeyNotSetException -> SomeException)
-> (SomeException -> Maybe KeyNotSetException)
-> (KeyNotSetException -> String)
-> Exception KeyNotSetException
SomeException -> Maybe KeyNotSetException
KeyNotSetException -> String
KeyNotSetException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: KeyNotSetException -> SomeException
toException :: KeyNotSetException -> SomeException
$cfromException :: SomeException -> Maybe KeyNotSetException
fromException :: SomeException -> Maybe KeyNotSetException
$cdisplayException :: KeyNotSetException -> String
displayException :: KeyNotSetException -> String
Exception via ViaSomeBotanException KeyNotSetException
data InvalidKeyLengthException
= InvalidKeyLengthException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InvalidKeyLengthException -> ShowS
[InvalidKeyLengthException] -> ShowS
InvalidKeyLengthException -> String
(Int -> InvalidKeyLengthException -> ShowS)
-> (InvalidKeyLengthException -> String)
-> ([InvalidKeyLengthException] -> ShowS)
-> Show InvalidKeyLengthException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvalidKeyLengthException -> ShowS
showsPrec :: Int -> InvalidKeyLengthException -> ShowS
$cshow :: InvalidKeyLengthException -> String
show :: InvalidKeyLengthException -> String
$cshowList :: [InvalidKeyLengthException] -> ShowS
showList :: [InvalidKeyLengthException] -> ShowS
Show)
deriving Show InvalidKeyLengthException
Typeable InvalidKeyLengthException
(Typeable InvalidKeyLengthException,
Show InvalidKeyLengthException) =>
(InvalidKeyLengthException -> SomeException)
-> (SomeException -> Maybe InvalidKeyLengthException)
-> (InvalidKeyLengthException -> String)
-> Exception InvalidKeyLengthException
SomeException -> Maybe InvalidKeyLengthException
InvalidKeyLengthException -> String
InvalidKeyLengthException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InvalidKeyLengthException -> SomeException
toException :: InvalidKeyLengthException -> SomeException
$cfromException :: SomeException -> Maybe InvalidKeyLengthException
fromException :: SomeException -> Maybe InvalidKeyLengthException
$cdisplayException :: InvalidKeyLengthException -> String
displayException :: InvalidKeyLengthException -> String
Exception via ViaSomeBotanException InvalidKeyLengthException
data InvalidObjectStateException
= InvalidObjectStateException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InvalidObjectStateException -> ShowS
[InvalidObjectStateException] -> ShowS
InvalidObjectStateException -> String
(Int -> InvalidObjectStateException -> ShowS)
-> (InvalidObjectStateException -> String)
-> ([InvalidObjectStateException] -> ShowS)
-> Show InvalidObjectStateException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvalidObjectStateException -> ShowS
showsPrec :: Int -> InvalidObjectStateException -> ShowS
$cshow :: InvalidObjectStateException -> String
show :: InvalidObjectStateException -> String
$cshowList :: [InvalidObjectStateException] -> ShowS
showList :: [InvalidObjectStateException] -> ShowS
Show)
deriving Show InvalidObjectStateException
Typeable InvalidObjectStateException
(Typeable InvalidObjectStateException,
Show InvalidObjectStateException) =>
(InvalidObjectStateException -> SomeException)
-> (SomeException -> Maybe InvalidObjectStateException)
-> (InvalidObjectStateException -> String)
-> Exception InvalidObjectStateException
SomeException -> Maybe InvalidObjectStateException
InvalidObjectStateException -> String
InvalidObjectStateException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InvalidObjectStateException -> SomeException
toException :: InvalidObjectStateException -> SomeException
$cfromException :: SomeException -> Maybe InvalidObjectStateException
fromException :: SomeException -> Maybe InvalidObjectStateException
$cdisplayException :: InvalidObjectStateException -> String
displayException :: InvalidObjectStateException -> String
Exception via ViaSomeBotanException InvalidObjectStateException
data NotImplementedException
= NotImplementedException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> NotImplementedException -> ShowS
[NotImplementedException] -> ShowS
NotImplementedException -> String
(Int -> NotImplementedException -> ShowS)
-> (NotImplementedException -> String)
-> ([NotImplementedException] -> ShowS)
-> Show NotImplementedException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotImplementedException -> ShowS
showsPrec :: Int -> NotImplementedException -> ShowS
$cshow :: NotImplementedException -> String
show :: NotImplementedException -> String
$cshowList :: [NotImplementedException] -> ShowS
showList :: [NotImplementedException] -> ShowS
Show)
deriving Show NotImplementedException
Typeable NotImplementedException
(Typeable NotImplementedException, Show NotImplementedException) =>
(NotImplementedException -> SomeException)
-> (SomeException -> Maybe NotImplementedException)
-> (NotImplementedException -> String)
-> Exception NotImplementedException
SomeException -> Maybe NotImplementedException
NotImplementedException -> String
NotImplementedException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: NotImplementedException -> SomeException
toException :: NotImplementedException -> SomeException
$cfromException :: SomeException -> Maybe NotImplementedException
fromException :: SomeException -> Maybe NotImplementedException
$cdisplayException :: NotImplementedException -> String
displayException :: NotImplementedException -> String
Exception via ViaSomeBotanException NotImplementedException
data InvalidObjectException
= InvalidObjectException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> InvalidObjectException -> ShowS
[InvalidObjectException] -> ShowS
InvalidObjectException -> String
(Int -> InvalidObjectException -> ShowS)
-> (InvalidObjectException -> String)
-> ([InvalidObjectException] -> ShowS)
-> Show InvalidObjectException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvalidObjectException -> ShowS
showsPrec :: Int -> InvalidObjectException -> ShowS
$cshow :: InvalidObjectException -> String
show :: InvalidObjectException -> String
$cshowList :: [InvalidObjectException] -> ShowS
showList :: [InvalidObjectException] -> ShowS
Show)
deriving Show InvalidObjectException
Typeable InvalidObjectException
(Typeable InvalidObjectException, Show InvalidObjectException) =>
(InvalidObjectException -> SomeException)
-> (SomeException -> Maybe InvalidObjectException)
-> (InvalidObjectException -> String)
-> Exception InvalidObjectException
SomeException -> Maybe InvalidObjectException
InvalidObjectException -> String
InvalidObjectException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: InvalidObjectException -> SomeException
toException :: InvalidObjectException -> SomeException
$cfromException :: SomeException -> Maybe InvalidObjectException
fromException :: SomeException -> Maybe InvalidObjectException
$cdisplayException :: InvalidObjectException -> String
displayException :: InvalidObjectException -> String
Exception via ViaSomeBotanException InvalidObjectException
data UnknownException
= UnknownException BotanErrorCode BotanErrorMessage CallStack
deriving stock (Int -> UnknownException -> ShowS
[UnknownException] -> ShowS
UnknownException -> String
(Int -> UnknownException -> ShowS)
-> (UnknownException -> String)
-> ([UnknownException] -> ShowS)
-> Show UnknownException
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnknownException -> ShowS
showsPrec :: Int -> UnknownException -> ShowS
$cshow :: UnknownException -> String
show :: UnknownException -> String
$cshowList :: [UnknownException] -> ShowS
showList :: [UnknownException] -> ShowS
Show)
deriving Show UnknownException
Typeable UnknownException
(Typeable UnknownException, Show UnknownException) =>
(UnknownException -> SomeException)
-> (SomeException -> Maybe UnknownException)
-> (UnknownException -> String)
-> Exception UnknownException
SomeException -> Maybe UnknownException
UnknownException -> String
UnknownException -> SomeException
forall e.
(Typeable e, Show e) =>
(e -> SomeException)
-> (SomeException -> Maybe e) -> (e -> String) -> Exception e
$ctoException :: UnknownException -> SomeException
toException :: UnknownException -> SomeException
$cfromException :: SomeException -> Maybe UnknownException
fromException :: SomeException -> Maybe UnknownException
$cdisplayException :: UnknownException -> String
displayException :: UnknownException -> String
Exception via ViaSomeBotanException UnknownException
throwBotanError :: HasCallStack => CInt -> IO a
throwBotanError :: forall a. HasCallStack => CInt -> IO a
throwBotanError CInt
r = CInt -> CallStack -> IO a
forall a. CInt -> CallStack -> IO a
throwBotanErrorWithCallstack CInt
r CallStack
HasCallStack => CallStack
callStack
throwBotanIfNegative :: HasCallStack => IO CInt -> IO CInt
throwBotanIfNegative :: HasCallStack => IO CInt -> IO CInt
throwBotanIfNegative IO CInt
act = do
CInt
e <- IO CInt
act
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (CInt
e CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ CInt -> CallStack -> IO ()
forall a. CInt -> CallStack -> IO a
throwBotanErrorWithCallstack CInt
e CallStack
HasCallStack => CallStack
callStack
CInt -> IO CInt
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CInt
e
throwBotanIfNegative_ :: HasCallStack => IO CInt -> IO ()
throwBotanIfNegative_ :: HasCallStack => IO CInt -> IO ()
throwBotanIfNegative_ IO CInt
act = do
CInt
e <- IO CInt
act
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (CInt
e CInt -> CInt -> Bool
forall a. Ord a => a -> a -> Bool
< CInt
0) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ CInt -> CallStack -> IO ()
forall a. CInt -> CallStack -> IO a
throwBotanErrorWithCallstack CInt
e CallStack
HasCallStack => CallStack
callStack
throwBotanCatchingInvalidVerifier :: HasCallStack => IO CInt -> IO Bool
throwBotanCatchingInvalidVerifier :: HasCallStack => IO CInt -> IO Bool
throwBotanCatchingInvalidVerifier = HasCallStack => CInt -> IO CInt -> IO Bool
CInt -> IO CInt -> IO Bool
throwBotanCatching CInt
forall a. (Eq a, Num a) => a
BOTAN_FFI_INVALID_VERIFIER
throwBotanCatchingInvalidInput :: HasCallStack => IO CInt -> IO Bool
throwBotanCatchingInvalidInput :: HasCallStack => IO CInt -> IO Bool
throwBotanCatchingInvalidInput = HasCallStack => CInt -> IO CInt -> IO Bool
CInt -> IO CInt -> IO Bool
throwBotanCatching CInt
forall a. (Eq a, Num a) => a
BOTAN_FFI_ERROR_INVALID_INPUT
throwBotanCatching :: HasCallStack => CInt -> IO CInt -> IO Bool
throwBotanCatching :: HasCallStack => CInt -> IO CInt -> IO Bool
throwBotanCatching CInt
x IO CInt
act = do
CInt
result <- IO CInt
act
case CInt
result of
CInt
BOTAN_FFI_SUCCESS -> Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
CInt
_ | CInt
x CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
result -> Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
| Bool
otherwise -> CInt -> CallStack -> IO Bool
forall a. CInt -> CallStack -> IO a
throwBotanErrorWithCallstack CInt
result CallStack
HasCallStack => CallStack
callStack
throwBotanCatchingBool :: HasCallStack => IO CInt -> IO Bool
throwBotanCatchingBool :: HasCallStack => IO CInt -> IO Bool
throwBotanCatchingBool IO CInt
act = do
CInt
result <- IO CInt
act
case CInt
result of
CInt
0 -> Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
CInt
1 -> Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
True
CInt
_ -> CInt -> CallStack -> IO Bool
forall a. CInt -> CallStack -> IO a
throwBotanErrorWithCallstack CInt
result CallStack
HasCallStack => CallStack
callStack
throwBotanErrorWithCallstack :: CInt -> CallStack -> IO a
throwBotanErrorWithCallstack :: forall a. CInt -> CallStack -> IO a
throwBotanErrorWithCallstack CInt
e CallStack
cs = do
BotanErrorMessage
emsg <- IO BotanErrorMessage
botanErrorLastExceptionMessage
case CInt
e of
CInt
BOTAN_FFI_INVALID_VERIFIER -> InvalidVerifierException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InvalidVerifierException -> IO a)
-> InvalidVerifierException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> InvalidVerifierException
InvalidVerifierException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_INVALID_INPUT -> InvalidInputException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InvalidInputException -> IO a) -> InvalidInputException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> InvalidInputException
InvalidInputException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_BAD_MAC -> BadMACException -> IO a
forall e a. Exception e => e -> IO a
throwIO (BadMACException -> IO a) -> BadMACException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode -> BotanErrorMessage -> CallStack -> BadMACException
BadMACException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_INSUFFICIENT_BUFFER_SPACE -> InsufficientBufferSpaceException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InsufficientBufferSpaceException -> IO a)
-> InsufficientBufferSpaceException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage
-> CallStack
-> InsufficientBufferSpaceException
InsufficientBufferSpaceException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_STRING_CONVERSION_ERROR -> StringConversionException -> IO a
forall e a. Exception e => e -> IO a
throwIO (StringConversionException -> IO a)
-> StringConversionException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> StringConversionException
StringConversionException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_EXCEPTION_THROWN -> ExceptionThrownException -> IO a
forall e a. Exception e => e -> IO a
throwIO (ExceptionThrownException -> IO a)
-> ExceptionThrownException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> ExceptionThrownException
ExceptionThrownException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_OUT_OF_MEMORY -> OutOfMemoryException -> IO a
forall e a. Exception e => e -> IO a
throwIO (OutOfMemoryException -> IO a) -> OutOfMemoryException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> OutOfMemoryException
OutOfMemoryException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_SYSTEM_ERROR -> SystemErrorException -> IO a
forall e a. Exception e => e -> IO a
throwIO (SystemErrorException -> IO a) -> SystemErrorException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> SystemErrorException
SystemErrorException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_INTERNAL_ERROR -> InternalErrorException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InternalErrorException -> IO a) -> InternalErrorException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> InternalErrorException
InternalErrorException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_BAD_FLAG -> BadFlagException -> IO a
forall e a. Exception e => e -> IO a
throwIO (BadFlagException -> IO a) -> BadFlagException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> BadFlagException
BadFlagException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_NULL_POINTER -> NullPointerException -> IO a
forall e a. Exception e => e -> IO a
throwIO (NullPointerException -> IO a) -> NullPointerException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> NullPointerException
NullPointerException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_BAD_PARAMETER -> BadParameterException -> IO a
forall e a. Exception e => e -> IO a
throwIO (BadParameterException -> IO a) -> BadParameterException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> BadParameterException
BadParameterException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_KEY_NOT_SET -> KeyNotSetException -> IO a
forall e a. Exception e => e -> IO a
throwIO (KeyNotSetException -> IO a) -> KeyNotSetException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> KeyNotSetException
KeyNotSetException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_INVALID_KEY_LENGTH -> InvalidKeyLengthException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InvalidKeyLengthException -> IO a)
-> InvalidKeyLengthException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> InvalidKeyLengthException
InvalidKeyLengthException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_INVALID_OBJECT_STATE -> InvalidObjectStateException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InvalidObjectStateException -> IO a)
-> InvalidObjectStateException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> InvalidObjectStateException
InvalidObjectStateException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_NOT_IMPLEMENTED -> NotImplementedException -> IO a
forall e a. Exception e => e -> IO a
throwIO (NotImplementedException -> IO a)
-> NotImplementedException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> NotImplementedException
NotImplementedException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
BOTAN_FFI_ERROR_INVALID_OBJECT -> InvalidObjectException -> IO a
forall e a. Exception e => e -> IO a
throwIO (InvalidObjectException -> IO a) -> InvalidObjectException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> InvalidObjectException
InvalidObjectException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
CInt
_ -> UnknownException -> IO a
forall e a. Exception e => e -> IO a
throwIO (UnknownException -> IO a) -> UnknownException -> IO a
forall a b. (a -> b) -> a -> b
$ BotanErrorCode
-> BotanErrorMessage -> CallStack -> UnknownException
UnknownException BotanErrorCode
bec BotanErrorMessage
emsg CallStack
cs
where
bec :: BotanErrorCode
bec = CInt -> BotanErrorCode
BotanErrorCode CInt
e