fix code message when grpc server return status whitout message (#386)

pull/340/head
Felix Hao 5 years ago committed by GitHub
parent 2220ca1e53
commit 526c532bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/ecode/status.go

@ -88,7 +88,7 @@ func FromCode(code Code) *Status {
// FromProto new status from grpc detail // FromProto new status from grpc detail
func FromProto(pbMsg proto.Message) Codes { func FromProto(pbMsg proto.Message) Codes {
if msg, ok := pbMsg.(*types.Status); ok { if msg, ok := pbMsg.(*types.Status); ok {
if msg.Message == "" { if msg.Message == "" || msg.Message == strconv.FormatInt(int64(msg.Code), 10) {
// NOTE: if message is empty convert to pure Code, will get message from config center. // NOTE: if message is empty convert to pure Code, will get message from config center.
return Code(msg.Code) return Code(msg.Code)
} }

Loading…
Cancel
Save