-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
102 lines (92 loc) · 2.07 KB
/
errors.go
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package helpers
type Error struct {
ID int // Error ID number
From string // From whence it came, and general error messages
}
const (
// Unexpected error
ErrorUnexpected = 1000 + iota // Unexpected internal error...
// Generic Table Query Errors
ErrorTableExists
ErrorTableDoesntExist
ErrorTableNameRequired
ErrorInvalidKeyCharacters
ErrorTableFull
ErrorQueryInvalidFormat
ErrorNoEntryFound
)
const (
// Schema creation errors
ErrorSchemaRequired = 2001 + iota
ErrorSchemaItemsRequired
ErrorSchemaInvalidItemName
ErrorSchemaInvalidItemPosition
ErrorSchemaInvalidItemType
ErrorSchemaInvalidItemParameters
ErrorSchemaInvalidFormat
ErrorSchemaInvalidTimeFormat
ErrorSchemaInvalid
ErrorObjectItemNotRequired // 2010
// Query Schema errors
ErrorInvalidItem
ErrorInvalidItemValue
ErrorInvalidMethod
ErrorInvalidMethodParameters
ErrorTooManyMethodParameters
ErrorNotEnoughMethodParameters
ErrorMissingRequiredItem
ErrorStringTooLarge
ErrorStringRequired
ErrorStringIsEncrypted // 2020
ErrorEncryptingString
ErrorArrayItemsRequired
ErrorArrayEmpty
ErrorArrayItemNotSortable
ErrorIndexOutOfBounds
ErrorMapItemsRequired
ErrorInvalidTimeFormat
ErrorUniqueValueDuplicate
ErrorRestoreItemSchema
)
const (
// Keystore Errors
ErrorKeyRequired = 3001 + iota
ErrorKeyInUse
)
const (
// Auth Table Query Errors
ErrorNameRequired = 4001 + iota
ErrorNameInUse
ErrorInvalidNameCharacters
ErrorPasswordLength
ErrorPasswordEncryption
ErrorNoEmailItem
ErrorIncorrectAuthType
ErrorInvalidEmail
)
const (
// Leaderboard errors
ErrorLeaderboardExists = 5001 + iota
ErrorLeaderboardDoesntExist
)
const (
// Storage errors
ErrorStorageNotInitialized = 9001 + iota
ErrorTableFolderCreate
ErrorCreatingFolder
ErrorFileOpen
ErrorFileAppend
ErrorFileUpdate
ErrorFileRead
ErrorFileWrite
ErrorFileDelete // 6010
ErrorJsonEncoding
ErrorJsonDecoding
ErrorJsonDataFormat
ErrorJsonIndexingFormat
ErrorInternalFormatting
)
// NewError creates a new Error message with given ID and From message
func NewError(id int, from string) Error {
return Error{ID: id, From: from}
}