For handled exceptions, call responseObserver.onError() . If you pass a StatusRuntimeException or a StatusException (usually status.asRuntimeException() using status.asRuntimeException() ), the status code and description will be passed to the client. Unhandled exceptions in the callback will cancel the RPC and will continue to throw an exception (usually leading to an UncaughtExceptionHandler call for the executor).
source share