diff --git a/pkg/gateway/lb/handler/grpc/handler.go b/pkg/gateway/lb/handler/grpc/handler.go index f6ef4fdb421..f471137bc16 100644 --- a/pkg/gateway/lb/handler/grpc/handler.go +++ b/pkg/gateway/lb/handler/grpc/handler.go @@ -130,19 +130,17 @@ func (s *server) exists(ctx context.Context, uuid string) (id *payload.Object_ID target + " deadline_exceeded: " + err.Error()) code = codes.DeadlineExceeded default: - st, msg, err = status.ParseError(err, codes.NotFound, "error "+vald.ExistsRPCName+" API meta "+uuid+"'s uuid not found", - &errdetails.RequestInfo{ - RequestId: uuid, - ServingData: errdetails.Serialize(meta), - }, - &errdetails.ResourceInfo{ - ResourceType: errdetails.ValdGRPCResourceTypePrefix + "/vald.v1." + vald.ExistsRPCName, - ResourceName: fmt.Sprintf("%s: %s(%s) to %s", apiName, s.name, s.ip, target), - }) - if st != nil { + st, ok := status.FromError(err) + if ok && st != nil { code = st.Code() + if st.Message() != "" { + msg = fmt.Sprintf("%s's uuid %s", uuid, st.Message()) + } else { + msg = fmt.Sprintf("%s's uuid not found", uuid) + } } else { code = codes.NotFound + msg = fmt.Sprintf("%s's uuid not found", uuid) } attrs = trace.FromGRPCStatus(code, msg) }