I have a server written in Java and client written in PHP. How can client catch exception from server if anything goes wrong? I can't find anything about exception handling in gRPC documentation.
Thank you!
For handled exceptions, call responseObserver.onError()
. If you pass in a StatusRuntimeException
or StatusException
(generally created via status.asRuntimeException()
) the status code and description will be communicated to the client. Unhandled exceptions within a callback will cancel the RPC and will continue propagating the exception (generally leading in an UncaughtExceptionHandler
being called for the executor).