mirror of
https://github.com/hibiken/asynq.git
synced 2025-04-20 07:40:19 +08:00
Merge 0eead6348ab5c4ac65b3901315bc1b99a508a462 into c327bc40a28e4db45195cfe082d88faa808ce87d
This commit is contained in:
commit
0d3d0779a3
@ -6,12 +6,16 @@ package asynq
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ErrHandlerNotFound indicates that no task handler was found for a given pattern.
|
||||||
|
var ErrHandlerNotFound = errors.New("handler not found for task")
|
||||||
|
|
||||||
// ServeMux is a multiplexer for asynchronous tasks.
|
// ServeMux is a multiplexer for asynchronous tasks.
|
||||||
// It matches the type of each task against a list of registered patterns
|
// It matches the type of each task against a list of registered patterns
|
||||||
// and calls the handler for the pattern that most closely matches the
|
// and calls the handler for the pattern that most closely matches the
|
||||||
@ -149,7 +153,7 @@ func (mux *ServeMux) Use(mws ...MiddlewareFunc) {
|
|||||||
|
|
||||||
// NotFound returns an error indicating that the handler was not found for the given task.
|
// NotFound returns an error indicating that the handler was not found for the given task.
|
||||||
func NotFound(ctx context.Context, task *Task) error {
|
func NotFound(ctx context.Context, task *Task) error {
|
||||||
return fmt.Errorf("handler not found for task %q", task.Type())
|
return fmt.Errorf("%w %q", ErrHandlerNotFound, task.Type())
|
||||||
}
|
}
|
||||||
|
|
||||||
// NotFoundHandler returns a simple task handler that returns a ``not found`` error.
|
// NotFoundHandler returns a simple task handler that returns a ``not found`` error.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user