etcdserver: remove panic and return default err
This commit is contained in:

committed by
Yicheng Qin

parent
021e231476
commit
c98f1cb501
@ -1,12 +1,16 @@
|
|||||||
package etcdserver
|
package etcdserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"code.google.com/p/go.net/context"
|
"code.google.com/p/go.net/context"
|
||||||
"github.com/coreos/etcd/raft"
|
"github.com/coreos/etcd/raft"
|
||||||
"github.com/coreos/etcd/store"
|
"github.com/coreos/etcd/store"
|
||||||
"github.com/coreos/etcd/wait"
|
"github.com/coreos/etcd/wait"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var ErrUnknownMethod = errors.New("etcdserver: unknown method")
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
// The last seen term raft was at when this request was built.
|
// The last seen term raft was at when this request was built.
|
||||||
Term int
|
Term int
|
||||||
@ -95,8 +99,9 @@ func (s *Server) Do(ctx context.Context, r Request) (Response, error) {
|
|||||||
}
|
}
|
||||||
return Response{Event: ev}, nil
|
return Response{Event: ev}, nil
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
return Response{}, ErrUnknownMethod
|
||||||
}
|
}
|
||||||
panic("not reached") // for some reason the compiler wants this... :/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apply interprets r as a call to store.X and returns an Response interpreted from store.Event
|
// apply interprets r as a call to store.X and returns an Response interpreted from store.Event
|
||||||
|
Reference in New Issue
Block a user