-
Notifications
You must be signed in to change notification settings - Fork 137
/
errors.go
46 lines (40 loc) · 1.64 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
package job
import (
"errors"
"net/http"
"github.com/labstack/echo/v4"
)
var (
// ErrClosed is using a closed system
ErrClosed = errors.New("jobs: closed")
// ErrNotFoundJob is used when the job could not be found
ErrNotFoundJob = errors.New("jobs: not found")
// ErrQueueClosed is used to indicate the queue is closed
ErrQueueClosed = errors.New("jobs: queue is closed")
// ErrUnknownWorker the asked worker does not exist
ErrUnknownWorker = errors.New("jobs: could not find worker")
// ErrMessageNil is used for an nil message
ErrMessageNil = errors.New("jobs: message is nil")
// ErrMessageUnmarshal is used when unmarshalling a message causes an error
ErrMessageUnmarshal = errors.New("jobs: message unmarshal")
// ErrAbort can be used to abort the execution of the job without causing
// errors.
ErrAbort = errors.New("jobs: abort")
// ErrUnknownTrigger is used when the trigger type is not recognized
ErrUnknownTrigger = errors.New("Unknown trigger type")
// ErrNotFoundTrigger is used when the trigger was not found
ErrNotFoundTrigger = errors.New("Trigger with specified ID does not exist")
// ErrMalformedTrigger is used to indicate the trigger is unparsable
ErrMalformedTrigger = echo.NewHTTPError(http.StatusBadRequest, "Trigger unparsable")
// ErrNotCronTrigger is used when a @cron trigger is expected, but it is
// not the case
ErrNotCronTrigger = errors.New("Invalid type for trigger (@cron expected)")
)
// BadTriggerError is an error conveying the information of a trigger that is not
// valid, and could be deleted.
type BadTriggerError struct {
Err error
}
func (e BadTriggerError) Error() string {
return e.Err.Error()
}