diff --git a/vertx-grpc-protoc-plugin/src/main/resources/VertxStub.mustache b/vertx-grpc-protoc-plugin/src/main/resources/VertxStub.mustache index 236e33b6..59289993 100644 --- a/vertx-grpc-protoc-plugin/src/main/resources/VertxStub.mustache +++ b/vertx-grpc-protoc-plugin/src/main/resources/VertxStub.mustache @@ -70,6 +70,10 @@ public final class {{className}} { public io.vertx.core.streams.ReadStream<{{outputType}}> {{methodName}}(io.vertx.core.Handler> hdlr) { return io.vertx.grpc.stub.ClientCalls.{{vertxCallsMethodName}}(ctx, hdlr, delegateStub::{{methodName}}); } + + public io.vertx.core.streams.ReadStream<{{outputType}}> {{methodName}}WithExceptionHandler(io.vertx.core.Handler> hdlr, io.vertx.core.Handler exceptionHandler) { + return io.vertx.grpc.stub.ClientCalls.{{vertxCallsMethodName}}(ctx, hdlr, delegateStub::{{methodName}}, exceptionHandler); + } {{/manyManyMethods}} } diff --git a/vertx-grpc/src/main/java/io/vertx/grpc/stub/ClientCalls.java b/vertx-grpc/src/main/java/io/vertx/grpc/stub/ClientCalls.java index 1f1d0842..51389f87 100644 --- a/vertx-grpc/src/main/java/io/vertx/grpc/stub/ClientCalls.java +++ b/vertx-grpc/src/main/java/io/vertx/grpc/stub/ClientCalls.java @@ -56,7 +56,12 @@ public static Future manyToOne(ContextInternal ctx, Handler ReadStream manyToMany(ContextInternal ctx, Handler> requestHandler, Function, StreamObserver> delegate) { + return manyToMany(ctx, requestHandler, delegate, null); + } + + public static ReadStream manyToMany(ContextInternal ctx, Handler> requestHandler, Function, StreamObserver> delegate, Handler exceptionHandler) { StreamObserverReadStream response = new StreamObserverReadStream<>(); + response.exceptionHandler(exceptionHandler); StreamObserver request = delegate.apply(response); requestHandler.handle(new GrpcWriteStream<>(request)); return response;