From 11d0fb47c292a0ca25a9c377499d2b221d97a5cb Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 26 May 2023 07:40:13 +0200 Subject: Init --- src/Data/JLD/Error.hs | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/Data/JLD/Error.hs (limited to 'src/Data/JLD/Error.hs') diff --git a/src/Data/JLD/Error.hs b/src/Data/JLD/Error.hs new file mode 100644 index 0000000..91c2a0b --- /dev/null +++ b/src/Data/JLD/Error.hs @@ -0,0 +1,81 @@ +module Data.JLD.Error (JLDError (..), toJldErrorCode) where + +import Data.JLD.Prelude + +import Data.JLD.Model.Keyword (Keyword (KeywordType)) + +import Data.Aeson (Value) + +data JLDError e + = InvalidKeywordValue Keyword Value + | ProcessingModeConflict + | InvalidContextEntry + | InvalidContextNullification + | InvalidLocalContext + | InvalidRemoteContext + | InvalidBaseIri + | InvalidVocabMapping + | InvalidDefaultLanguage + | InvalidBaseDirection + | LoadingRemoteContextError + | DocumentLoaderError e + | ContextOverflow + | InvalidTermDefinition + | CyclicIriMapping + | KeywordRedefinition + | InvalidTypeMapping + | InvalidReverseProperty + | InvalidIriMapping + | InvalidKeywordAlias + | InvalidContainerMapping + | InvalidLanguageMapping + | ProtectedTermRedefinition + | InvalidReversePropertyMap + | CollidingKeywords Text Keyword + | InvalidValueObjectValue + | InvalidLanguageTaggedString + | InvalidReversePropertyValue + | InvalidLanguageMapValue + | InvalidValueObject + | InvalidLanguageTaggedValue + | InvalidTypedValue + | InvalidSetOrListObject + | InvalidScopedContext + deriving (Eq, Show) + +toJldErrorCode :: JLDError e -> Text +toJldErrorCode (InvalidKeywordValue KeywordType _) = "invalid type value" +toJldErrorCode (InvalidKeywordValue keyword _) = "invalid " <> show keyword <> " value" +toJldErrorCode ProcessingModeConflict = "processing mode conflict" +toJldErrorCode InvalidContextEntry = "invalid context entry" +toJldErrorCode InvalidContextNullification = "invalid context nullification" +toJldErrorCode InvalidLocalContext = "invalid local context" +toJldErrorCode InvalidRemoteContext = "invalid remote context" +toJldErrorCode InvalidBaseIri = "invalid base IRI" +toJldErrorCode InvalidVocabMapping = "invalid vocab mapping" +toJldErrorCode InvalidDefaultLanguage = "invalid default language" +toJldErrorCode InvalidBaseDirection = "invalid base direction" +toJldErrorCode LoadingRemoteContextError = "loading remote context failed" +toJldErrorCode (DocumentLoaderError _) = "loading document failed" +toJldErrorCode ContextOverflow = "context overflow" +toJldErrorCode InvalidTermDefinition = "invalid term definition" +toJldErrorCode CyclicIriMapping = "cyclic IRI mapping" +toJldErrorCode KeywordRedefinition = "keyword redefinition" +toJldErrorCode InvalidTypeMapping = "invalid type mapping" +toJldErrorCode InvalidReverseProperty = "invalid reverse property" +toJldErrorCode InvalidIriMapping = "invalid IRI mapping" +toJldErrorCode InvalidKeywordAlias = "invalid keyword alias" +toJldErrorCode InvalidContainerMapping = "invalid container mapping" +toJldErrorCode InvalidLanguageMapping = "invalid language mapping" +toJldErrorCode ProtectedTermRedefinition = "protected term redefinition" +toJldErrorCode InvalidReversePropertyMap = "invalid reverse property map" +toJldErrorCode (CollidingKeywords _ _) = "colliding keywords" +toJldErrorCode InvalidValueObjectValue = "invalid value object value" +toJldErrorCode InvalidLanguageTaggedString = "invalid language-tagged string" +toJldErrorCode InvalidReversePropertyValue = "invalid reverse property value" +toJldErrorCode InvalidLanguageMapValue = "invalid language map value" +toJldErrorCode InvalidValueObject = "invalid value object" +toJldErrorCode InvalidLanguageTaggedValue = "invalid language-tagged value" +toJldErrorCode InvalidTypedValue = "invalid typed value" +toJldErrorCode InvalidSetOrListObject = "invalid set or list object" +toJldErrorCode InvalidScopedContext = "invalid scoped context" -- cgit v1.2.3-54-g00ecf