-
Notifications
You must be signed in to change notification settings - Fork 1
/
codes.go
42 lines (34 loc) · 854 Bytes
/
codes.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
package common
type StatusCode int
// Success codes
const (
OK StatusCode = iota + 2000
NamespaceAlreadyExists
UserAlreadyExists
)
// Authentication related error codes
const (
Unauthorized StatusCode = iota + 4000
)
// Error codes
const (
InternalServerError StatusCode = iota + 5000
InvalidStatementType
NamespaceDoesNotExist
UserDoesNotExist
CreateNamespaceError
)
var statusCodes = map[StatusCode]string{
// Success
OK: "OK",
NamespaceAlreadyExists: "NamespaceAlreadyExists",
UserAlreadyExists: "UserAlreadyExists",
// Security errors
Unauthorized: "Unauthorized",
// General errors
InternalServerError: "InternalServerError",
InvalidStatementType: "InvalidStatementType",
NamespaceDoesNotExist: "NamespaceDoesNotExist",
UserDoesNotExist: "UserDoesNotExist",
CreateNamespaceError: "CreateNamespaceError",
}