module SecondTransfer.Exception (
HTTP2SessionException (..)
,FramerException (..)
,BadPrefaceException (..)
,HTTP11Exception (..)
,HTTP11SyntaxException (..)
,ClientSessionAbortedException(..)
,HTTP500PrecursorException (..)
,ConnectionCloseReason(..)
,convertHTTP500PrecursorExceptionToException
,getHTTP500PrecursorExceptionFromException
,ContentLengthMissingException (..)
,IOProblem(..)
,GenericIOProblem(..)
,StreamCancelledException(..)
,HTTP2ProtocolException(..)
) where
import Control.Exception
import Data.Typeable
data HTTP2SessionException = forall e . Exception e => HTTP2SessionException e
deriving Typeable
instance Show HTTP2SessionException where
show (HTTP2SessionException e) = show e
instance Exception HTTP2SessionException
convertHTTP2SessionExceptionToException :: Exception e => e -> SomeException
convertHTTP2SessionExceptionToException = toException . HTTP2SessionException
getHTTP2SessionExceptionFromException :: Exception e => SomeException -> Maybe e
getHTTP2SessionExceptionFromException x = do
HTTP2SessionException a <- fromException x
cast a
data HTTP2ProtocolException = HTTP2ProtocolException
deriving (Typeable, Show)
instance Exception HTTP2ProtocolException where
toException = convertHTTP2SessionExceptionToException
fromException = getHTTP2SessionExceptionFromException
data ConnectionCloseReason =
NormalTermination_CCR
|SessionAlreadyClosed_CCR
|IOChannelClosed_CCR
|ProtocolError_CCR
deriving Show
data ClientSessionAbortedException = ClientSessionAbortedException ConnectionCloseReason
deriving (Typeable, Show)
instance Exception ClientSessionAbortedException where
toException = convertHTTP2SessionExceptionToException
fromException = getHTTP2SessionExceptionFromException
data FramerException = forall e . Exception e => FramerException e
deriving Typeable
instance Show FramerException where
show (FramerException e) = show e
instance Exception FramerException where
toException = convertHTTP2SessionExceptionToException
fromException = getHTTP2SessionExceptionFromException
convertFramerExceptionToException :: Exception e => e -> SomeException
convertFramerExceptionToException = toException . FramerException
getFramerExceptionFromException :: Exception e => SomeException -> Maybe e
getFramerExceptionFromException x = do
FramerException a <- fromException x
cast a
data BadPrefaceException = BadPrefaceException
deriving (Typeable, Show)
instance Exception BadPrefaceException where
toException = convertFramerExceptionToException
fromException = getFramerExceptionFromException
data HTTP11Exception = forall e . Exception e => HTTP11Exception e
deriving Typeable
instance Show HTTP11Exception where
show (HTTP11Exception e) = show e
instance Exception HTTP11Exception
convertHTTP11ExceptionToException :: Exception e => e -> SomeException
convertHTTP11ExceptionToException = toException . HTTP11Exception
getHTTP11ExceptionFromException :: Exception e => SomeException -> Maybe e
getHTTP11ExceptionFromException x = do
HTTP11Exception a <- fromException x
cast a
data HTTP500PrecursorException = forall e . Exception e => HTTP500PrecursorException e
deriving Typeable
instance Show HTTP500PrecursorException where
show (HTTP500PrecursorException e) = show e
convertHTTP500PrecursorExceptionToException :: Exception e => e -> SomeException
convertHTTP500PrecursorExceptionToException = toException . HTTP500PrecursorException
getHTTP500PrecursorExceptionFromException :: Exception e => SomeException -> Maybe e
getHTTP500PrecursorExceptionFromException x = do
HTTP500PrecursorException a <- fromException x
cast a
instance Exception HTTP500PrecursorException where
toException = convertHTTP11ExceptionToException
fromException = getHTTP11ExceptionFromException
data ContentLengthMissingException = ContentLengthMissingException
deriving (Typeable, Show)
instance Exception ContentLengthMissingException where
toException = convertHTTP11ExceptionToException
fromException = getHTTP11ExceptionFromException
data HTTP11SyntaxException = HTTP11SyntaxException String
deriving (Typeable, Show)
instance Exception HTTP11SyntaxException where
toException = convertHTTP11ExceptionToException
fromException = getHTTP11ExceptionFromException
data IOProblem = forall e . Exception e => IOProblem e
deriving Typeable
instance Show IOProblem where
show (IOProblem e) = show e
instance Exception IOProblem
data GenericIOProblem = GenericIOProblem
deriving (Show, Typeable)
instance Exception GenericIOProblem where
toException = toException . IOProblem
fromException x = do
IOProblem a <- fromException x
cast a
data StreamCancelledException = StreamCancelledException
deriving (Show, Typeable)
instance Exception StreamCancelledException