forked from scylladb/gocql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made errorFrame an interface that can implemented by the different ty…
…pes of errors from a cassandra server.
- Loading branch information
1 parent
e617f1d
commit 0879b50
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 errorFrame interface { | ||
Code() int | ||
Message() string | ||
Error() string | ||
} | ||
|
||
type errorResponse struct { | ||
code int | ||
message string | ||
} | ||
|
||
func (e errorResponse) Code() int { | ||
return e.code | ||
} | ||
|
||
func (e errorResponse) Message() string { | ||
return e.message | ||
} | ||
|
||
func (e errorResponse) Error() string { | ||
return e.Message() | ||
} | ||
|
||
type errRespUnavailable struct { | ||
errorResponse | ||
Consistency Consistency | ||
Required int | ||
Alive int | ||
} | ||
|
||
type errRespWriteTimeout struct { | ||
errorResponse | ||
Consistency Consistency | ||
Received int | ||
BlockFor int | ||
WriteType string | ||
} | ||
|
||
type errRespReadTimeout struct { | ||
errorResponse | ||
Consistency Consistency | ||
Received int | ||
BlockFor int | ||
DataPresent byte | ||
} | ||
|
||
type errRespAlreadyExists struct { | ||
errorResponse | ||
Keyspace string | ||
Table string | ||
} | ||
|
||
type errRespUnprepared struct { | ||
errorResponse | ||
StatementId []byte | ||
} |