{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE NoImplicitPrelude #-}
module System.Etc.Internal.Errors where
import RIO
import qualified Data.Aeson as JSON
import System.Etc.Internal.Spec.Types
newtype InvalidConfigKeyPath = InvalidConfigKeyPath {
inputKeys :: [Text]
}
deriving (Generic, Show, Read, Eq)
instance Exception InvalidConfigKeyPath
data ConfigValueParserFailed = ConfigValueParserFailed {
inputKeys :: ![Text]
, parserErrorMessage :: !Text
}
deriving (Generic, Show, Read, Eq)
instance Exception ConfigValueParserFailed
data UnknownConfigKeyFound = UnknownConfigKeyFound {
parentKeys :: ![Text]
, keyName :: !Text
, siblingKeys :: ![Text]
}
deriving (Generic, Show, Read, Eq)
instance Exception UnknownConfigKeyFound
data SubConfigEntryExpected =
SubConfigEntryExpected {
keyName :: !Text
, configValue :: !JSON.Value
}
deriving (Generic, Show, Read, Eq)
instance Exception SubConfigEntryExpected
data ConfigValueTypeMismatchFound = ConfigValueTypeMismatchFound {
keyName :: !Text
, configValueEntry :: !JSON.Value
, configValueEntryType :: !ConfigValueType
}
deriving (Generic, Show, Read, Eq)
instance Exception ConfigValueTypeMismatchFound
newtype ConfigurationFileNotFound =
ConfigurationFileNotFound {
configFilepath :: Text
}
deriving (Generic, Show, Read, Eq)
instance Exception ConfigurationFileNotFound
newtype UnsupportedFileExtensionGiven =
UnsupportedFileExtensionGiven {
configFilepath :: Text
}
deriving (Generic, Show, Read, Eq)
instance Exception UnsupportedFileExtensionGiven
data ConfigInvalidSyntaxFound
= ConfigInvalidSyntaxFound {
configFilepath :: !Text
, parserErrorMessage :: !Text
}
deriving (Generic, Show, Read, Eq)
instance Exception ConfigInvalidSyntaxFound
data SpecInvalidSyntaxFound = SpecInvalidSyntaxFound {
specFilepath :: !(Maybe Text)
, parseErrorMessage :: !Text
}
deriving (Generic, Show, Read, Eq)
instance Exception SpecInvalidSyntaxFound