@@ -91,9 +91,8 @@ private static <V> V requireNonNull(V value, String message) {
9191 * structures or call {@link java.util.concurrent.CompletableFuture#get()
9292 * get()} before accessing results from the calling thread.
9393 * @return CompletableFuture<Void> that completes when the stream is exhausted,
94- * or fails exceptionally. All errors — including null arguments, configuration
95- * validation failures, and HTTP errors — are routed through the future;
96- * callers only need {@code .exceptionally()} handling.
94+ * or fails exceptionally for configuration or HTTP errors.
95+ * @throws IllegalArgumentException if {@code requestBuilder} or {@code consumer} is null
9796 */
9897 public CompletableFuture <Void > stream (ApiExecutorRequestBuilder requestBuilder , Consumer <T > consumer ) {
9998 return stream (requestBuilder , consumer , null );
@@ -110,21 +109,21 @@ public CompletableFuture<Void> stream(ApiExecutorRequestBuilder requestBuilder,
110109 * {@code CompletableFuture} always reflects the error regardless of
111110 * whether an {@code errorConsumer} is present.
112111 * @return CompletableFuture<Void> that completes when the stream is exhausted,
113- * or fails exceptionally. All errors — including null arguments, configuration
114- * validation failures, and HTTP errors — are routed through the future;
115- * callers only need {@code .exceptionally()} handling.
112+ * or fails exceptionally for configuration or HTTP errors.
113+ * @throws IllegalArgumentException if {@code requestBuilder} or {@code consumer} is null
116114 */
117115 public CompletableFuture <Void > stream (
118116 ApiExecutorRequestBuilder requestBuilder ,
119117 Consumer <T > consumer ,
120118 @ Nullable Consumer <Throwable > errorConsumer ) {
119+ if (requestBuilder == null ) {
120+ throw new IllegalArgumentException ("Request builder cannot be null" );
121+ }
122+ if (consumer == null ) {
123+ throw new IllegalArgumentException ("Consumer cannot be null" );
124+ }
125+
121126 try {
122- if (requestBuilder == null ) {
123- throw new IllegalArgumentException ("Request builder cannot be null" );
124- }
125- if (consumer == null ) {
126- throw new IllegalArgumentException ("Consumer cannot be null" );
127- }
128127 configuration .assertValid ();
129128 return processStreamingResponse (
130129 requestBuilder .buildHttpRequest (configuration , apiClient ), consumer , errorConsumer );
0 commit comments