In C++, `error_details` in grpc::Status is a string. So you probably want to serialize your object to the wire format or json. If there's a Any field in a message, you should be able to do something like this:
``` MyMessage msg; Any any = msg.mutable_someanyfield(); any->PackFrom(myobject); ``` On Tue, Oct 20, 2020 at 4:01 AM Eric Hansen <[email protected]> wrote: > In my C++ grpc server, I'm trying to pack another proto (e.t. > deviceStatus) into the Status proto but I cannot find 'Any' in the c++ API, > nor any examples about how to do this in C++ > > This is how I do it in Java... > com.google.rpc.Status build = com.google.rpc.Status.newBuilder() > .setCode(grpcErrorCode.getNumber()) .setMessage(dex.getMessage()) > .addDetails(Any.pack(deviceStatus)) .build(); > > Thanks for any pointers... > > -- > You received this message because you are subscribed to the Google Groups " > grpc.io" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/grpc-io/11a263cf-69da-44d5-b8f2-7f0e3f7fc79an%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/11a263cf-69da-44d5-b8f2-7f0e3f7fc79an%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAABt8Y9LsOc6PZFQMCohLSKNBH%2B1LLUwUkDGAZdaE7dcvpWKsQ%40mail.gmail.com.
