module Data.Grib.Exception
(
GribException(..)
, isAnyGribException
, isGribException
, isNullPtrReturned
, ErrorCode(..)
) where
import Control.Exception ( Exception )
import Data.Typeable ( Typeable )
import Data.Grib.Raw.Error
data GribException = GribException ErrorCode
| NullPtrReturned
deriving (Show, Typeable)
instance Exception GribException
isAnyGribException :: GribException -> Bool
isAnyGribException = const True
isGribException :: ErrorCode -> GribException -> Bool
isGribException code (GribException code') = code' == code
isGribException _ NullPtrReturned = False
isNullPtrReturned :: GribException -> Bool
isNullPtrReturned NullPtrReturned = True
isNullPtrReturned _ = False