You can provide additional details in the Metadata, which can be attached
to a StatusException/StatusRuntimeException. You would define a proto
message to hold the specific details you care about and then pass it in the
Metadata directly on in a google.rpc.Status. See
https://stackoverflow.com/a/48750825/4690866 for how that looks.

On Tue, Dec 10, 2019 at 7:41 PM <[email protected]> wrote:

> Hello,
>
> I'm wondering how I can send an application specific error code to clients
> in grpc-java.
>
> I've been using gprc-java for a few years, but I haven't used onError api
> in a server
> since there seems no way to return application specific error status/code
> to a client.
> (Unless I serialize the code to String and pass it through description or
> something)
>
> It would be great if experts can give me some advice for this.
>
> Thanks,
> Hiro
>
> --
> 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/9a02e7f4-25ea-4943-8d0e-987122a99e02%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/9a02e7f4-25ea-4943-8d0e-987122a99e02%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/CA%2B4M1oPUQqBwc3818pmUfRMq6iTp-OjzeO1g%3DBAKaeSe7iQ72w%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to