diff --git a/runtime/errors.go b/runtime/errors.go index 429a2162400..18ff5e44616 100644 --- a/runtime/errors.go +++ b/runtime/errors.go @@ -5,7 +5,6 @@ import ( "net/http" "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" "golang.org/x/net/context" "google.golang.org/grpc/codes" @@ -93,19 +92,9 @@ func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w } body := &errorBody{ - Error: s.Message(), - Code: int32(s.Code()), - } - - for _, detail := range s.Details() { - if det, ok := detail.(proto.Message); ok { - a, err := ptypes.MarshalAny(det) - if err != nil { - grpclog.Printf("Failed to marshal any: %v", err) - } else { - body.Details = append(body.Details, a) - } - } + Error: s.Message(), + Code: int32(s.Code()), + Details: s.Proto().GetDetails(), } buf, merr := marshaler.Marshal(body)