Documentation ¶
Overview ¶
Package errors defines the error type and functions used by asynq and its internal packages.
Index ¶
- Variables
- func As(err error, target interface{}) bool
- func E(args ...interface{}) error
- func Is(err, target error) bool
- func IsPanicError(err error) bool
- func IsQueueNotEmpty(err error) bool
- func IsQueueNotFound(err error) bool
- func IsRedisCommandError(err error) bool
- func IsTaskAlreadyArchived(err error) bool
- func IsTaskNotFound(err error) bool
- func New(text string) error
- func Unwrap(err error) error
- type Code
- type Error
- type Op
- type PanicError
- type QueueNotEmptyError
- type QueueNotFoundError
- type RedisCommandError
- type TaskAlreadyArchivedError
- type TaskNotFoundError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoProcessableTask indicates that there are no tasks ready to be processed. ErrNoProcessableTask = errors.New("no tasks are ready for processing") // ErrDuplicateTask indicates that another task with the same unique key holds the uniqueness lock. ErrDuplicateTask = errors.New("task already exists") // ErrTaskIdConflict indicates that another task with the same task ID already exist ErrTaskIdConflict = errors.New("task id conflicts with another task") )
Functions ¶
func As ¶
As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true. Otherwise, it returns false.
This function is the errors.As function from the standard library (https://golang.org/pkg/errors/#As). It is exported from this package for import convenience.
func E ¶
func E(args ...interface{}) error
E builds an error value from its arguments. There must be at least one argument or E panics. The type of each argument determines its meaning. If more than one argument of a given type is presented, only the last one is recorded.
The types are:
errors.Op The operation being performed, usually the method being invoked (Get, Put, etc.). errors.Code The canonical error code, such as NOT_FOUND. string Treated as an error message and assigned to the Err field after a call to errors.New. error The underlying error that triggered this one.
If the error is printed, only those items that have been set to non-zero values will appear in the result.
func Is ¶
Is reports whether any error in err's chain matches target.
This function is the errors.Is function from the standard library (https://golang.org/pkg/errors/#Is). It is exported from this package for import convenience.
func IsPanicError ¶
IsPanicError reports whether any error in err's chain is of type PanicError.
func IsQueueNotEmpty ¶
IsQueueNotEmpty reports whether any error in err's chain is of type QueueNotEmptyError.
func IsQueueNotFound ¶
IsQueueNotFound reports whether any error in err's chain is of type QueueNotFoundError.
func IsRedisCommandError ¶
IsRedisCommandError reports whether any error in err's chain is of type RedisCommandError.
func IsTaskAlreadyArchived ¶
IsTaskAlreadyArchived reports whether any error in err's chain is of type TaskAlreadyArchivedError.
func IsTaskNotFound ¶
IsTaskNotFound reports whether any error in err's chain is of type TaskNotFoundError.
func New ¶
New returns an error that formats as the given text. Each call to New returns a distinct error value even if the text is identical.
This function is the errors.New function from the standard library (https://golang.org/pkg/errors/#New). It is exported from this package for import convenience.
func Unwrap ¶
Unwrap returns the result of calling the Unwrap method on err, if err's type contains an Unwrap method returning error. Otherwise, Unwrap returns nil.
This function is the errors.Unwrap function from the standard library (https://golang.org/pkg/errors/#Unwrap). It is exported from this package for import convenience.
Types ¶
type Code ¶
type Code uint8
Code defines the canonical error code.
List of canonical error codes.
func CanonicalCode ¶
CanonicalCode returns the canonical code of the given error if one is present. Otherwise it returns Unspecified.
type Error ¶
Error is the type that implements the error interface. It contains a number of fields, each of different type. An Error value may leave some values unset.
func (*Error) DebugString ¶
type Op ¶
type Op string
Op describes an operation, usually as the package and method, such as "rdb.Enqueue".
type PanicError ¶
type PanicError struct {
ErrMsg string
}
PanicError defines an error when occurred a panic error.
func (*PanicError) Error ¶
func (e *PanicError) Error() string
type QueueNotEmptyError ¶
type QueueNotEmptyError struct {
Queue string // queue name
}
QueueNotEmptyError indicates that the given queue is not empty.
func (*QueueNotEmptyError) Error ¶
func (e *QueueNotEmptyError) Error() string
type QueueNotFoundError ¶
type QueueNotFoundError struct {
Queue string // queue name
}
QueueNotFoundError indicates that a queue with the given name does not exist.
func (*QueueNotFoundError) Error ¶
func (e *QueueNotFoundError) Error() string
type RedisCommandError ¶
type RedisCommandError struct { Command string // redis command (e.g. LRANGE, ZADD, etc) Err error // underlying error }
RedisCommandError indicates that the given redis command returned error.
func (*RedisCommandError) Error ¶
func (e *RedisCommandError) Error() string
func (*RedisCommandError) Unwrap ¶
func (e *RedisCommandError) Unwrap() error
type TaskAlreadyArchivedError ¶
TaskAlreadyArchivedError indicates that the task in question is already archived.
func (*TaskAlreadyArchivedError) Error ¶
func (e *TaskAlreadyArchivedError) Error() string
type TaskNotFoundError ¶
TaskNotFoundError indicates that a task with the given ID does not exist in the given queue.
func (*TaskNotFoundError) Error ¶
func (e *TaskNotFoundError) Error() string