|
@@ -28,7 +28,7 @@ type Executor struct {
|
|
|
seq int64
|
|
|
locker sync.RWMutex
|
|
|
params []string //params (eg: /show/user/:uid => :uid)
|
|
|
- NotFoundHandle func(ctx *Context, cmd string) (*Response, error)
|
|
|
+ NotFoundHandle HandleFunc
|
|
|
}
|
|
|
|
|
|
type (
|
|
@@ -184,7 +184,9 @@ func (exec *Executor) Do(ctx *Context, args ...string) (res *Response, err error
|
|
|
}
|
|
|
if exec.handleFunc == nil {
|
|
|
if exec.NotFoundHandle != nil {
|
|
|
- res, err = exec.NotFoundHandle(ctx, ctx.CmdStr)
|
|
|
+ if err = exec.NotFoundHandle(ctx); err == nil {
|
|
|
+ res = ctx.response
|
|
|
+ }
|
|
|
} else {
|
|
|
err = fmt.Errorf("%s not found", ctx.CmdStr)
|
|
|
}
|