generated from devnw/oss-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
errors.go
52 lines (40 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package plex
import (
"errors"
"fmt"
"net"
)
// errTimeout is returned when a request times out.
var errTimeout = errors.New("timeout")
// errClosed is returned when an internal channel in the multiplexer is closed.
var errClosed = errors.New("closed")
var errConnectorNil = errors.New("connector method is nil")
var errInvalidMaxCapacity = errors.New("max capacity must be greater than zero")
var errTooManyConns = errors.New("connection count exceeds configured capacity")
var errInvalidTimeout = errors.New("timeout must be greater than zero")
var errImproperAutoScalingNilConnector = errors.New(
"auto-scaling connector cannot be nil",
)
type ErrConnection struct {
net.Addr
error
}
func disconnected(addr net.Addr) error {
return &ErrConnection{
addr,
errors.New("disconnected"),
}
}
type errAddrMismatch struct {
Expected net.Addr
Actual net.Addr
}
func (e errAddrMismatch) Error() string {
return fmt.Sprintf(
"address mismatch; expected: %s:%s; actual: %s:%s",
e.Expected.Network(),
e.Expected,
e.Actual.Network(),
e.Actual,
)
}