Put errors together (#7958)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2021-09-15 21:05:52 +08:00 committed by GitHub
parent c63086fefa
commit c76f91233f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -16,6 +16,17 @@ import (
"fmt"
)
// errNilKvClient stands for a nil kv client is detected when initialized
var errNilKvClient = errors.New("kv client not initialized")
// serverNotServingErrMsg used for Status Reason when datacoord is not healthy
const serverNotServingErrMsg = "server is not serving"
// errors for VerifyResponse
var errNilResponse = errors.New("response is nil")
var errNilStatusResponse = errors.New("response has nil status")
var errUnknownResponseType = errors.New("unknown response type")
func msgDataCoordIsUnhealthy(coordID UniqueID) string {
return fmt.Sprintf("data coord %d is not ready", coordID)
}

View File

@ -58,8 +58,6 @@ type (
Timestamp = typeutil.Timestamp
)
var errNilKvClient = errors.New("kv client not initialized")
// ServerState type alias, presents datacoord Server State
type ServerState = int64

View File

@ -15,8 +15,6 @@ import (
"go.uber.org/zap"
)
const serverNotServingErrMsg = "server is not serving"
// checks whether server in Healthy State
func (s *Server) isClosed() bool {
return atomic.LoadInt64(&s.isServing) != ServerStateHealthy

View File

@ -25,10 +25,6 @@ type Response interface {
GetStatus() *commonpb.Status
}
var errNilResponse = errors.New("response is nil")
var errNilStatusResponse = errors.New("response has nil status")
var errUnknownResponseType = errors.New("unknown response type")
// VerifyResponse verify grpc Response 1. check error is nil 2. check response.GetStatus() with status success
func VerifyResponse(response interface{}, err error) error {
if err != nil {