Skip to content

Commit

Permalink
Specify transport exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Jan 30, 2025
1 parent fa4041e commit cc71793
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

package software.amazon.smithy.java.client.core;

import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.concurrent.CompletableFuture;
import software.amazon.smithy.java.context.Context;

Expand All @@ -25,6 +30,22 @@ public interface ClientTransport<RequestT, ResponseT> extends ClientPlugin {
/**
* Send a prepared request.
*
* <p>Transports must only <strong>must</strong> throw exceptions from Java's standard library or exceptions that
* subclass them, including but not limited to:
*
* <ul>
* <li>{@link IOException}</li>
* <li>{@link SocketException}</li>
* <li>{@link SocketTimeoutException}</li>
* <li>{@link ConnectException}</li>
* <li>{@link InterruptedIOException}</li>
* <li>{@link InterruptedException}</li>
* </ul>
*
* <p>Transports that do not use these standard Java exceptions or subclass from them <strong>must</strong>
* wrap transport-specific exceptions into these types to ensure that changing the transport of a client doesn't
* impact the user-facing API of a client call.
*
* @param context Call context.
* @param request Request to send.
* @return a CompletableFuture that is completed with the response.
Expand Down

0 comments on commit cc71793

Please sign in to comment.