You need to add a ClientInterceptor too. It will provide a listener which overrides the onClose(Status, Metadata) method of a ClientCall.Listener. There, you can check for your metadata row added by the server, and return the proper type of error to the next listener in your interceptor chain.
On Thursday, March 1, 2018 at 1:10:36 AM UTC-8, [email protected] wrote: > > Here's the example that shows what I'm trying to achieve - > https://github.com/cartmanez/grpc-java-by-example/tree/master/error-handling-example > The idea is the following: > I have a set of domain exception known by each microservice. There's a > mapping domain exception <-> StatusRuntimeException > Server automatically converts domain exception into > StatusRuntimeException. That's done by server interceptor. > And I'd like to convert it back to domain exception on the client side, so > that calling code does not need to worry about StatusRuntimeException at > all and only works with domain exceptions. > > Thanks in advance. > > Regards, > Eduard > > On Wednesday, February 14, 2018 at 10:01:36 PM UTC+3, Carl Mastrangelo > wrote: >> >> No updates. If you can upload your code somewhere, it would be clearer >> why the interceptor wouldn't work. >> >> On Friday, February 9, 2018 at 5:52:34 AM UTC-8, [email protected] >> wrote: >>> >>> Hi! >>> >>> Any updates on this? >>> >>> I checked version 1.9.0 and still don't see a way to do exception >>> conversion in an interceptor. >>> I now think of writing my own wrappers for all blocking stubs to perform >>> exception conversion. That would allow not to check status codes across the >>> application and just catch specific exceptions where needed. >>> However, having the ability to define an exception transformer globally >>> for grpc client would of course make life easier. >>> >>> Thanks >>> >> -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b513705f-4c89-4e62-badd-12d49561dd60%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
