forked from tendermint/tendermint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
35 lines (29 loc) · 1.05 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
package privval
import (
"errors"
"fmt"
)
// EndpointTimeoutError occurs when endpoint times out.
type EndpointTimeoutError struct{}
// Implement the net.Error interface.
func (e EndpointTimeoutError) Error() string { return "endpoint connection timed out" }
func (e EndpointTimeoutError) Timeout() bool { return true }
func (e EndpointTimeoutError) Temporary() bool { return true }
// Socket errors.
var (
ErrConnectionTimeout = EndpointTimeoutError{}
ErrNoConnection = errors.New("endpoint is not connected")
ErrReadTimeout = errors.New("endpoint read timed out")
ErrUnexpectedResponse = errors.New("empty response")
ErrWriteTimeout = errors.New("endpoint write timed out")
)
// RemoteSignerError allows (remote) validators to include meaningful error
// descriptions in their reply.
type RemoteSignerError struct {
// TODO(ismail): create an enum of known errors
Code int
Description string
}
func (e *RemoteSignerError) Error() string {
return fmt.Sprintf("signerEndpoint returned error #%d: %s", e.Code, e.Description)
}