-
Notifications
You must be signed in to change notification settings - Fork 56
/
err.go
30 lines (22 loc) · 826 Bytes
/
err.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
package tcp
import (
"errors"
"golang.org/x/sys/unix"
)
// ErrTimeout indicates I/O timeout
var ErrTimeout = &timeoutError{}
type timeoutError struct{}
func (e *timeoutError) Error() string { return "I/O timeout" }
func (e *timeoutError) Timeout() bool { return true }
func (e *timeoutError) Temporary() bool { return true }
// ErrConnect is an error occurs while connecting to the host
// To get the detail of underlying error, lookup ErrorCode() in 'man 2 connect'
type ErrConnect struct {
error
}
// newErrConnect returns a ErrConnect with given error code
func newErrConnect(errCode int) *ErrConnect {
return &ErrConnect{unix.Errno(errCode)}
}
// ErrCheckerAlreadyStarted indicates there is another instance of CheckingLoop running.
var ErrCheckerAlreadyStarted = errors.New("Checker was already started")