forked from mailgun/groupcache
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patherrors.go
More file actions
75 lines (63 loc) · 1.84 KB
/
Copy patherrors.go
File metadata and controls
75 lines (63 loc) · 1.84 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package groupcache
// ErrNotFound should be returned from an implementation of `GetterFunc` to indicate the
// requested value is not available. When remote HTTP calls are made to retrieve values from
// other groupcache instances, returning this error will indicate to groupcache that the
// value requested is not available, and it should NOT attempt to call `GetterFunc` locally.
type ErrNotFound struct {
Msg string
}
func (e *ErrNotFound) Error() string {
if e.Msg == "" {
return "not found error"
}
return e.Msg
}
func (e *ErrNotFound) Is(target error) bool {
_, ok := target.(*ErrNotFound)
return ok
}
// ErrRemoteCall is returned from `group.Get()` when a remote GetterFunc returns an
// error. When this happens `group.Get()` does not attempt to retrieve the value
// via our local GetterFunc.
type ErrRemoteCall struct {
Msg string
}
func (e *ErrRemoteCall) Error() string {
if e.Msg == "" {
return "remote call error"
}
return e.Msg
}
func (e *ErrRemoteCall) Is(target error) bool {
_, ok := target.(*ErrRemoteCall)
return ok
}
// ErrPeerGone is returned when the peer we are trying to talk to is shutting down and is currently draining its queue.
// When receiving this error it doesn't make sense to retry as the peer will never respond with the actual answer.
type ErrPeerGone struct {
Msg string
}
func (e *ErrPeerGone) Error() string {
if e.Msg == "" {
return "peer gone error"
}
return e.Msg
}
func (e *ErrPeerGone) Is(target error) bool {
_, ok := target.(*ErrPeerGone)
return ok
}
// ErrNoSuchGroup is returned when the peer we are talking to does not have the group we are asking for.
type ErrNoSuchGroup struct {
Msg string
}
func (e *ErrNoSuchGroup) Error() string {
if e.Msg == "" {
return "no such group"
}
return e.Msg
}
func (e *ErrNoSuchGroup) Is(target error) bool {
_, ok := target.(*ErrNoSuchGroup)
return ok
}