forked from apache/cassandra-gocql-driver
-
Notifications
You must be signed in to change notification settings - Fork 2
/
errors.go
76 lines (65 loc) · 1.23 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
package gocql
const (
errServer = 0x0000
errProtocol = 0x000A
errCredentials = 0x0100
errUnavailable = 0x1000
errOverloaded = 0x1001
errBootstrapping = 0x1002
errTruncate = 0x1003
errWriteTimeout = 0x1100
errReadTimeout = 0x1200
errSyntax = 0x2000
errUnauthorized = 0x2100
errInvalid = 0x2200
errConfig = 0x2300
errAlreadyExists = 0x2400
errUnprepared = 0x2500
)
type RequestError interface {
Code() int
Message() string
Error() string
}
type errorFrame struct {
code int
message string
}
func (e errorFrame) Code() int {
return e.code
}
func (e errorFrame) Message() string {
return e.message
}
func (e errorFrame) Error() string {
return e.Message()
}
type RequestErrUnavailable struct {
errorFrame
Consistency Consistency
Required int
Alive int
}
type RequestErrWriteTimeout struct {
errorFrame
Consistency Consistency
Received int
BlockFor int
WriteType string
}
type RequestErrReadTimeout struct {
errorFrame
Consistency Consistency
Received int
BlockFor int
DataPresent byte
}
type RequestErrAlreadyExists struct {
errorFrame
Keyspace string
Table string
}
type RequestErrUnprepared struct {
errorFrame
StatementId []byte
}