{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}

module SDL.Exception
  ( SDLException(..)
  ) where

import Control.Exception
import Data.Data (Data)
import Data.Text (Text)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)

-- | Error details about a failure to call an SDL routine. Almost all functions in this library have the
-- ability to produce exceptions of this type. Inspection should help you learn more about what has
-- gone wrong.
data SDLException
  = -- | A call to a low-level SDL C function failed unexpectedly.
    SDLCallFailed
    {SDLException -> Text
sdlExceptionCaller :: !Text
     -- ^ The Haskell routine that was trying to call a C function
    ,SDLException -> Text
sdlFunction :: !Text
     -- ^ The C function that was called and produced an error
    ,SDLException -> Text
sdlExceptionError :: !Text
    -- ^ SDL's understanding of what has gone wrong
    }
  | -- | An SDL C function was called with an unexpected argument.
    SDLUnexpectedArgument
    {sdlExceptionCaller :: !Text
     -- ^ The Haskell routine that was trying to call a C function
    ,sdlFunction :: !Text
     -- ^ The C function that was called and produced an error
    ,SDLException -> String
sdlUnknownValue :: !String
     -- ^ The argument that SDL failed to understand
    }
  | -- | A hint was attempted to be set, but SDL does not know about this hint.
    SDLUnknownHintValue
    {SDLException -> String
sdlHint :: !String
     -- ^ The hint that could not be set
    ,sdlUnknownValue :: !String
     -- ^ The value that could not be set
    }
  deriving (Typeable SDLException
SDLException -> DataType
SDLException -> Constr
(forall b. Data b => b -> b) -> SDLException -> SDLException
forall a.
Typeable a
-> (forall (c :: Type -> Type).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: Type -> Type).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: Type -> Type -> Type) (c :: Type -> Type).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: Type -> Type).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: Type -> Type).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> SDLException -> u
forall u. (forall d. Data d => d -> u) -> SDLException -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SDLException -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SDLException -> r
forall (m :: Type -> Type).
Monad m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
forall (m :: Type -> Type).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
forall (c :: Type -> Type).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SDLException
forall (c :: Type -> Type).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SDLException -> c SDLException
forall (t :: Type -> Type) (c :: Type -> Type).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SDLException)
forall (t :: Type -> Type -> Type) (c :: Type -> Type).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SDLException)
gmapMo :: forall (m :: Type -> Type).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
$cgmapMo :: forall (m :: Type -> Type).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
gmapMp :: forall (m :: Type -> Type).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
$cgmapMp :: forall (m :: Type -> Type).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
gmapM :: forall (m :: Type -> Type).
Monad m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
$cgmapM :: forall (m :: Type -> Type).
Monad m =>
(forall d. Data d => d -> m d) -> SDLException -> m SDLException
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SDLException -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SDLException -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> SDLException -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SDLException -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SDLException -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SDLException -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SDLException -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SDLException -> r
gmapT :: (forall b. Data b => b -> b) -> SDLException -> SDLException
$cgmapT :: (forall b. Data b => b -> b) -> SDLException -> SDLException
dataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SDLException)
$cdataCast2 :: forall (t :: Type -> Type -> Type) (c :: Type -> Type).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SDLException)
dataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SDLException)
$cdataCast1 :: forall (t :: Type -> Type) (c :: Type -> Type).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SDLException)
dataTypeOf :: SDLException -> DataType
$cdataTypeOf :: SDLException -> DataType
toConstr :: SDLException -> Constr
$ctoConstr :: SDLException -> Constr
gunfold :: forall (c :: Type -> Type).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SDLException
$cgunfold :: forall (c :: Type -> Type).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SDLException
gfoldl :: forall (c :: Type -> Type).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SDLException -> c SDLException
$cgfoldl :: forall (c :: Type -> Type).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SDLException -> c SDLException
Data,SDLException -> SDLException -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SDLException -> SDLException -> Bool
$c/= :: SDLException -> SDLException -> Bool
== :: SDLException -> SDLException -> Bool
$c== :: SDLException -> SDLException -> Bool
Eq,forall x. Rep SDLException x -> SDLException
forall x. SDLException -> Rep SDLException x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SDLException x -> SDLException
$cfrom :: forall x. SDLException -> Rep SDLException x
Generic,Eq SDLException
SDLException -> SDLException -> Bool
SDLException -> SDLException -> Ordering
SDLException -> SDLException -> SDLException
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SDLException -> SDLException -> SDLException
$cmin :: SDLException -> SDLException -> SDLException
max :: SDLException -> SDLException -> SDLException
$cmax :: SDLException -> SDLException -> SDLException
>= :: SDLException -> SDLException -> Bool
$c>= :: SDLException -> SDLException -> Bool
> :: SDLException -> SDLException -> Bool
$c> :: SDLException -> SDLException -> Bool
<= :: SDLException -> SDLException -> Bool
$c<= :: SDLException -> SDLException -> Bool
< :: SDLException -> SDLException -> Bool
$c< :: SDLException -> SDLException -> Bool
compare :: SDLException -> SDLException -> Ordering
$ccompare :: SDLException -> SDLException -> Ordering
Ord,ReadPrec [SDLException]
ReadPrec SDLException
Int -> ReadS SDLException
ReadS [SDLException]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SDLException]
$creadListPrec :: ReadPrec [SDLException]
readPrec :: ReadPrec SDLException
$creadPrec :: ReadPrec SDLException
readList :: ReadS [SDLException]
$creadList :: ReadS [SDLException]
readsPrec :: Int -> ReadS SDLException
$creadsPrec :: Int -> ReadS SDLException
Read,Int -> SDLException -> ShowS
[SDLException] -> ShowS
SDLException -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SDLException] -> ShowS
$cshowList :: [SDLException] -> ShowS
show :: SDLException -> String
$cshow :: SDLException -> String
showsPrec :: Int -> SDLException -> ShowS
$cshowsPrec :: Int -> SDLException -> ShowS
Show,Typeable)

instance Exception SDLException