diff options
Diffstat (limited to 'src/Data/JLD/Error.hs')
-rw-r--r-- | src/Data/JLD/Error.hs | 81 |
1 files changed, 81 insertions, 0 deletions
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 @@ | |||
1 | module Data.JLD.Error (JLDError (..), toJldErrorCode) where | ||
2 | |||
3 | import Data.JLD.Prelude | ||
4 | |||
5 | import Data.JLD.Model.Keyword (Keyword (KeywordType)) | ||
6 | |||
7 | import Data.Aeson (Value) | ||
8 | |||
9 | data JLDError e | ||
10 | = InvalidKeywordValue Keyword Value | ||
11 | | ProcessingModeConflict | ||
12 | | InvalidContextEntry | ||
13 | | InvalidContextNullification | ||
14 | | InvalidLocalContext | ||
15 | | InvalidRemoteContext | ||
16 | | InvalidBaseIri | ||
17 | | InvalidVocabMapping | ||
18 | | InvalidDefaultLanguage | ||
19 | | InvalidBaseDirection | ||
20 | | LoadingRemoteContextError | ||
21 | | DocumentLoaderError e | ||
22 | | ContextOverflow | ||
23 | | InvalidTermDefinition | ||
24 | | CyclicIriMapping | ||
25 | | KeywordRedefinition | ||
26 | | InvalidTypeMapping | ||
27 | | InvalidReverseProperty | ||
28 | | InvalidIriMapping | ||
29 | | InvalidKeywordAlias | ||
30 | | InvalidContainerMapping | ||
31 | | InvalidLanguageMapping | ||
32 | | ProtectedTermRedefinition | ||
33 | | InvalidReversePropertyMap | ||
34 | | CollidingKeywords Text Keyword | ||
35 | | InvalidValueObjectValue | ||
36 | | InvalidLanguageTaggedString | ||
37 | | InvalidReversePropertyValue | ||
38 | | InvalidLanguageMapValue | ||
39 | | InvalidValueObject | ||
40 | | InvalidLanguageTaggedValue | ||
41 | | InvalidTypedValue | ||
42 | | InvalidSetOrListObject | ||
43 | | InvalidScopedContext | ||
44 | deriving (Eq, Show) | ||
45 | |||
46 | toJldErrorCode :: JLDError e -> Text | ||
47 | toJldErrorCode (InvalidKeywordValue KeywordType _) = "invalid type value" | ||
48 | toJldErrorCode (InvalidKeywordValue keyword _) = "invalid " <> show keyword <> " value" | ||
49 | toJldErrorCode ProcessingModeConflict = "processing mode conflict" | ||
50 | toJldErrorCode InvalidContextEntry = "invalid context entry" | ||
51 | toJldErrorCode InvalidContextNullification = "invalid context nullification" | ||
52 | toJldErrorCode InvalidLocalContext = "invalid local context" | ||
53 | toJldErrorCode InvalidRemoteContext = "invalid remote context" | ||
54 | toJldErrorCode InvalidBaseIri = "invalid base IRI" | ||
55 | toJldErrorCode InvalidVocabMapping = "invalid vocab mapping" | ||
56 | toJldErrorCode InvalidDefaultLanguage = "invalid default language" | ||
57 | toJldErrorCode InvalidBaseDirection = "invalid base direction" | ||
58 | toJldErrorCode LoadingRemoteContextError = "loading remote context failed" | ||
59 | toJldErrorCode (DocumentLoaderError _) = "loading document failed" | ||
60 | toJldErrorCode ContextOverflow = "context overflow" | ||
61 | toJldErrorCode InvalidTermDefinition = "invalid term definition" | ||
62 | toJldErrorCode CyclicIriMapping = "cyclic IRI mapping" | ||
63 | toJldErrorCode KeywordRedefinition = "keyword redefinition" | ||
64 | toJldErrorCode InvalidTypeMapping = "invalid type mapping" | ||
65 | toJldErrorCode InvalidReverseProperty = "invalid reverse property" | ||
66 | toJldErrorCode InvalidIriMapping = "invalid IRI mapping" | ||
67 | toJldErrorCode InvalidKeywordAlias = "invalid keyword alias" | ||
68 | toJldErrorCode InvalidContainerMapping = "invalid container mapping" | ||
69 | toJldErrorCode InvalidLanguageMapping = "invalid language mapping" | ||
70 | toJldErrorCode ProtectedTermRedefinition = "protected term redefinition" | ||
71 | toJldErrorCode InvalidReversePropertyMap = "invalid reverse property map" | ||
72 | toJldErrorCode (CollidingKeywords _ _) = "colliding keywords" | ||
73 | toJldErrorCode InvalidValueObjectValue = "invalid value object value" | ||
74 | toJldErrorCode InvalidLanguageTaggedString = "invalid language-tagged string" | ||
75 | toJldErrorCode InvalidReversePropertyValue = "invalid reverse property value" | ||
76 | toJldErrorCode InvalidLanguageMapValue = "invalid language map value" | ||
77 | toJldErrorCode InvalidValueObject = "invalid value object" | ||
78 | toJldErrorCode InvalidLanguageTaggedValue = "invalid language-tagged value" | ||
79 | toJldErrorCode InvalidTypedValue = "invalid typed value" | ||
80 | toJldErrorCode InvalidSetOrListObject = "invalid set or list object" | ||
81 | toJldErrorCode InvalidScopedContext = "invalid scoped context" | ||