1-- |
2-- Module      : Data.ASN1.Error
3-- License     : BSD-style
4-- Maintainer  : Vincent Hanquez <vincent@snarc.org>
5-- Stability   : experimental
6-- Portability : unknown
7--
8{-# LANGUAGE DeriveDataTypeable #-}
9{-# LANGUAGE BangPatterns #-}
10module Data.ASN1.Error
11    (
12    -- * Errors types
13      ASN1Error(..)
14    ) where
15
16import Control.Exception (Exception)
17import Data.Typeable
18
19-- | Possible errors during parsing operations
20data ASN1Error = StreamUnexpectedEOC         -- ^ Unexpected EOC in the stream.
21               | StreamInfinitePrimitive     -- ^ Invalid primitive with infinite length in a stream.
22               | StreamConstructionWrongSize -- ^ A construction goes over the size specified in the header.
23               | StreamUnexpectedSituation String -- ^ An unexpected situation has come up parsing an ASN1 event stream.
24               | ParsingHeaderFail String    -- ^ Parsing an invalid header.
25               | ParsingPartial              -- ^ Parsing is not finished, there is construction unended.
26               | TypeNotImplemented String   -- ^ Decoding of a type that is not implemented. Contribution welcome.
27               | TypeDecodingFailed String   -- ^ Decoding of a knowed type failed.
28               | TypePrimitiveInvalid String -- ^ Invalid primitive type
29               | PolicyFailed String String -- ^ Policy failed including the name of the policy and the reason.
30               deriving (Typeable, Show, Eq)
31
32instance Exception ASN1Error
33