-
Notifications
You must be signed in to change notification settings - Fork 8
/
error.go
34 lines (28 loc) · 814 Bytes
/
error.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
package tnt
import "errors"
var (
// ErrRequestTimeout means timeout while sending request.
ErrRequestTimeout = NewConnectionError("Request send timeout")
// ErrResponseTimeout means timeout while request waiting.
ErrResponseTimeout = NewConnectionError("Response read timeout")
// ErrConnectionClosed means connection have been closed already.
ErrConnectionClosed = NewConnectionError("Connection closed")
// ErrShredOldRequests means request ID error.
ErrShredOldRequests = NewConnectionError("Shred old requests")
)
type ConnectionError struct {
error
}
type QueryError struct {
error
}
func NewConnectionError(message string) error {
return &ConnectionError{
error: errors.New(message),
}
}
func NewQueryError(message string) error {
return &QueryError{
error: errors.New(message),
}
}