fix etcd prefix
This commit is contained in:
parent
79363aabf0
commit
87ea785119
|
@ -19,6 +19,8 @@ func parseArgs(cmd string) {
|
|||
switch cmd {
|
||||
case "-v", "--v", "-version", "--version":
|
||||
versionCmd()
|
||||
case "--json":
|
||||
versionCmdJson()
|
||||
}
|
||||
|
||||
os.Exit(0)
|
||||
|
@ -28,3 +30,7 @@ func versionCmd() {
|
|||
fmt.Printf("[Blocks Service: %s] Version: %s \n", vars.ServiceKey, vars.VERSION)
|
||||
fmt.Printf("[Blocks Service: %s] Compile: %s by %s build.\n", vars.ServiceKey, vars.GO_VERSION, vars.BUILD_TIME)
|
||||
}
|
||||
|
||||
func versionCmdJson() {
|
||||
fmt.Printf("{\"version\":\"%s\",\"build_time\":\"%s\"}\n", vars.VERSION, vars.BUILD_TIME)
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package exception
|
|||
|
||||
// jwt custom error code ,begin:200
|
||||
var (
|
||||
ErrAuthPasswd = ErrorJson(201, "Password Error")
|
||||
ErrAuthNotFound = ErrorJson(202, "Auth Token Not Found")
|
||||
ErrAuthParseFail = ErrorJson(203, "Auth Parse Fail")
|
||||
ErrAuthId = ErrorJson(204, "Auth Id Not Passed")
|
||||
ErrAuthIdentity = ErrorJson(205, "Auth Identity Not Passed")
|
||||
ErrAuthTokenChanged = ErrorJson(206, "Auth Token Changed")
|
||||
ErrAuthIdType = ErrorJson(207, "Auth Id Type Error")
|
||||
ErrAuthExpire = ErrorJson(208, "Auth Token Expire")
|
||||
ErrAuthClient = ErrorJson(208, "Auth Token Client Not Passed")
|
||||
ErrAuthPasswd = Errorf(201, "Password Error")
|
||||
ErrAuthNotFound = Errorf(202, "Auth Token Not Found")
|
||||
ErrAuthParseFail = Errorf(203, "Auth Parse Fail")
|
||||
ErrAuthId = Errorf(204, "Auth Id Not Passed")
|
||||
ErrAuthIdentity = Errorf(205, "Auth Identity Not Passed")
|
||||
ErrAuthTokenChanged = Errorf(206, "Auth Token Changed")
|
||||
ErrAuthIdType = Errorf(207, "Auth Id Type Error")
|
||||
ErrAuthExpire = Errorf(208, "Auth Token Expire")
|
||||
ErrAuthClient = Errorf(208, "Auth Token Client Not Passed")
|
||||
)
|
||||
|
|
|
@ -2,9 +2,9 @@ package exception
|
|||
|
||||
// db custom error code ,begin:300
|
||||
var (
|
||||
ErrDBFatal = ErrorJson(300, "DB Fatal error")
|
||||
ErrCacheFatal = ErrorJson(301, "Cache Fatal error")
|
||||
ErrEtcdFatal = ErrorJson(302, "Etcd Fatal error")
|
||||
ErrElasticFatal = ErrorJson(303, "Elastic Fatal error")
|
||||
ErrBlocksMQFatal = ErrorJson(304, "BlocksMQ Fatal error")
|
||||
ErrDBFatal = Errorf(300, "DB Fatal error")
|
||||
ErrCacheFatal = Errorf(301, "Cache Fatal error")
|
||||
ErrEtcdFatal = Errorf(302, "Etcd Fatal error")
|
||||
ErrElasticFatal = Errorf(303, "Elastic Fatal error")
|
||||
ErrBlocksMQFatal = Errorf(304, "BlocksMQ Fatal error")
|
||||
)
|
||||
|
|
|
@ -9,27 +9,27 @@ import (
|
|||
|
||||
var (
|
||||
// google grpc error status.
|
||||
OK = ErrorJson(0, "OK")
|
||||
ErrCanceled = ErrorJson(1, "Canceled")
|
||||
ErrUnknown = ErrorJson(2, "Unknown")
|
||||
ErrInvalidArgument = ErrorJson(3, "Invalid Argument")
|
||||
ErrDeadlineExceeded = ErrorJson(4, "Deadline Exceeded")
|
||||
ErrNotFound = ErrorJson(5, "Not Found")
|
||||
ErrAlreadyExists = ErrorJson(6, "Already Exists")
|
||||
ErrPermissionDenied = ErrorJson(7, "Permission Denied")
|
||||
ErrResourceExhausted = ErrorJson(8, "Resource Exhausted")
|
||||
ErrFailedPrecondition = ErrorJson(9, "Failed Precondition")
|
||||
ErrAborted = ErrorJson(10, "Aborted")
|
||||
ErrOutOfRange = ErrorJson(11, "Out Of Range")
|
||||
ErrUnimplemented = ErrorJson(12, "Unimplemented")
|
||||
ErrInternal = ErrorJson(13, "Internal")
|
||||
ErrUnavailable = ErrorJson(14, "Unavailable")
|
||||
ErrDataLoss = ErrorJson(15, "Data Loss")
|
||||
ErrUnauthenticated = ErrorJson(16, "Unauthenticated")
|
||||
ErrJSONMarshal = ErrorJson(17, "Marshal JSON")
|
||||
ErrJSONUnmarshal = ErrorJson(18, "Unmarshal JSON")
|
||||
OK = Errorf(0, "OK")
|
||||
ErrCanceled = Errorf(1, "Canceled")
|
||||
ErrUnknown = Errorf(2, "Unknown")
|
||||
ErrInvalidArgument = Errorf(3, "Invalid Argument")
|
||||
ErrDeadlineExceeded = Errorf(4, "Deadline Exceeded")
|
||||
ErrNotFound = Errorf(5, "Not Found")
|
||||
ErrAlreadyExists = Errorf(6, "Already Exists")
|
||||
ErrPermissionDenied = Errorf(7, "Permission Denied")
|
||||
ErrResourceExhausted = Errorf(8, "Resource Exhausted")
|
||||
ErrFailedPrecondition = Errorf(9, "Failed Precondition")
|
||||
ErrAborted = Errorf(10, "Aborted")
|
||||
ErrOutOfRange = Errorf(11, "Out Of Range")
|
||||
ErrUnimplemented = Errorf(12, "Unimplemented")
|
||||
ErrInternal = Errorf(13, "Internal")
|
||||
ErrUnavailable = Errorf(14, "Unavailable")
|
||||
ErrDataLoss = Errorf(15, "Data Loss")
|
||||
ErrUnauthenticated = Errorf(16, "Unauthenticated")
|
||||
ErrJSONMarshal = Errorf(17, "Marshal JSON")
|
||||
ErrJSONUnmarshal = Errorf(18, "Unmarshal JSON")
|
||||
|
||||
ErrSmsCode = ErrorJson(20, "SMS Code Invalid")
|
||||
ErrSmsCode = Errorf(20, "SMS Code Invalid")
|
||||
|
||||
// coustom error status
|
||||
)
|
||||
|
@ -41,7 +41,3 @@ func Error(c uint32, msg string) error {
|
|||
func Errorf(c uint32, format string, a ...interface{}) error {
|
||||
return status.New(codes.Code(c), fmt.Sprintf(format, a...)).Err()
|
||||
}
|
||||
|
||||
func ErrorJson(c uint32, msg string) error {
|
||||
return status.New(codes.Code(c), fmt.Sprintf(`{ "Code": %d, "Msg": "%s" }`, c, msg)).Err()
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package exception
|
|||
|
||||
// mq custom error code ,begin:900
|
||||
var (
|
||||
ErrMQClient = ErrorJson(900, "MQ Connect Error")
|
||||
ErrMQDispatch = ErrorJson(901, "MQ Dispatch Error")
|
||||
ErrMQProducer = ErrorJson(902, "MQ Producer Error")
|
||||
ErrMQConsumer = ErrorJson(902, "MQ Consumer Error")
|
||||
ErrMQInternal = ErrorJson(903, "MQ Internal Error")
|
||||
ErrMQStorage = ErrorJson(904, "MQ Storage Error")
|
||||
ErrMQClient = Errorf(900, "MQ Connect Error")
|
||||
ErrMQDispatch = Errorf(901, "MQ Dispatch Error")
|
||||
ErrMQProducer = Errorf(902, "MQ Producer Error")
|
||||
ErrMQConsumer = Errorf(902, "MQ Consumer Error")
|
||||
ErrMQInternal = Errorf(903, "MQ Internal Error")
|
||||
ErrMQStorage = Errorf(904, "MQ Storage Error")
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue