-
Notifications
You must be signed in to change notification settings - Fork 206
/
errors.go
53 lines (42 loc) · 1.22 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
53
package rmq
import (
"errors"
"fmt"
)
var (
ErrorNotFound = errors.New("entity not found") // entity being connection/queue/delivery/heartbeat
ErrorAlreadyConsuming = errors.New("must not call StartConsuming() multiple times")
ErrorNotConsuming = errors.New("must call StartConsuming() before adding consumers")
ErrorConsumingStopped = errors.New("consuming stopped")
)
type ConsumeError struct {
RedisErr error
Count int // number of consecutive errors
}
func (e *ConsumeError) Error() string {
return fmt.Sprintf("rmq.ConsumeError (%d): %s", e.Count, e.RedisErr.Error())
}
func (e *ConsumeError) Unwrap() error {
return e.RedisErr
}
type HeartbeatError struct {
RedisErr error
Count int // number of consecutive errors
}
func (e *HeartbeatError) Error() string {
return fmt.Sprintf("rmq.HeartbeatError (%d): %s", e.Count, e.RedisErr.Error())
}
func (e *HeartbeatError) Unwrap() error {
return e.RedisErr
}
type DeliveryError struct {
Delivery Delivery
RedisErr error
Count int // number of consecutive errors
}
func (e *DeliveryError) Error() string {
return fmt.Sprintf("rmq.DeliveryError (%d): %s", e.Count, e.RedisErr.Error())
}
func (e *DeliveryError) Unwrap() error {
return e.RedisErr
}