Skip to content

Commit 68e2992

Browse files
authored
CheckedForwardingClientCall should pass trailers from the caught exception (grpc#10356)
`StatusException` thrown from `checkedStart()` may have `trailers`. Therefore, `CheckedForwardingClientCall` should pass the `trailers` to `responseListener.onClose()`.
1 parent 1af6b24 commit 68e2992

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

api/src/main/java/io/grpc/ClientInterceptors.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ public final void start(Listener<RespT> responseListener, Metadata headers) {
236236
// to a NO-OP one to prevent the IllegalStateException. The user will finally get notified
237237
// about the error through the listener.
238238
delegate = (ClientCall<ReqT, RespT>) NOOP_CALL;
239-
responseListener.onClose(Status.fromThrowable(e), new Metadata());
239+
Metadata trailers = Status.trailersFromThrowable(e);
240+
responseListener.onClose(
241+
Status.fromThrowable(e),
242+
trailers != null ? trailers : new Metadata()
243+
);
240244
}
241245
}
242246
}

0 commit comments

Comments
 (0)