-
Notifications
You must be signed in to change notification settings - Fork 8
/
errors.go
59 lines (48 loc) · 1.63 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
54
55
56
57
58
59
package curlyq
import (
"fmt"
)
// ErrFailedToRetryJob indicates an error when scheduling a retry.
// It is considered a fatal error that should shut down the consumer.
type ErrFailedToRetryJob struct {
Job Job
Err error
}
func (e ErrFailedToRetryJob) Error() string {
return fmt.Sprintf("Failed to retry job %s: %s", e.Job.ID, e.Err.Error())
}
// ErrFailedToKillJob indicates an error when marking a job as dead.
// It is considered a fatal error that should shut down the consumer.
type ErrFailedToKillJob struct {
Job Job
Err error
}
func (e ErrFailedToKillJob) Error() string {
return fmt.Sprintf("Failed to kill job %s: %s", e.Job.ID, e.Err.Error())
}
// ErrFailedToAckJob indicates an error when acknowledging a completed job.
// It is considered a fatal error that should shut down the consumer.
type ErrFailedToAckJob struct {
Job Job
Err error
}
func (e ErrFailedToAckJob) Error() string {
return fmt.Sprintf("Failed to acknowledge job %s: %s", e.Job.ID, e.Err.Error())
}
// ErrExceededMaxBackoff indicates a polling loop exceeded a maximum number of backoffs.
// It is considered a fatal error that should shut down the consumer.
type ErrExceededMaxBackoff struct {
Attempt int
Process string
}
func (e ErrExceededMaxBackoff) Error() string {
return fmt.Sprintf("Process %s exceeded maximum %d backoff attempts", e.Process, e.Attempt)
}
// ErrJobAlreadyExists indicates that a job was not enqueued or scheduled
// because another job with the same ID already exists in Redis.
type ErrJobAlreadyExists struct {
Job Job
}
func (e ErrJobAlreadyExists) Error() string {
return fmt.Sprintf("Job with id %s already exists", e.Job.ID)
}