aboutsummaryrefslogtreecommitdiffstats
path: root/src/Data/JLD/Error.hs
blob: 7b6fdecd2e72db320d8362a1a25c8e7fb291f6b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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
    | ConflictingIndexes
    | IRIConfusedWithPrefix
    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"
toJldErrorCode ConflictingIndexes = "conflicting indexes"