You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getErrorCode() in software.amazon.awssdk.crt.http.HttpException is package-private, which means the only method available to classify errors is to parse the message. When we fail to acquire a connection, we throw different exceptions to our consumers (HttpFailureException for generic connection failures, and HttpConnectionTimeoutException if it was specifically a timeout), which leads to brittle and obviously incorrect classification such as the below:
if (err.getMessage() != null && err.getMessage().contains("negotiation failed")) {
throw new HttpFailureException(err.getMessage());
}
final String msg = format("Failed to get connection within %d ms: %s",
params.getConnectionTimeoutMillis(), err.getMessage());
throw new HttpConnectionTimeoutException(msg);
}
In general, I support a singular exception type as it makes error handling cleaner in cases when we don't particularly care about the cause of the exception. Exposing the errorCode or the result of CRT.awsErrorName(errorCode) would be sufficient for cases where we do care.
The text was updated successfully, but these errors were encountered:
getErrorCode() in software.amazon.awssdk.crt.http.HttpException is package-private, which means the only method available to classify errors is to parse the message. When we fail to acquire a connection, we throw different exceptions to our consumers (HttpFailureException for generic connection failures, and HttpConnectionTimeoutException if it was specifically a timeout), which leads to brittle and obviously incorrect classification such as the below:
In general, I support a singular exception type as it makes error handling cleaner in cases when we don't particularly care about the cause of the exception. Exposing the errorCode or the result of CRT.awsErrorName(errorCode) would be sufficient for cases where we do care.
The text was updated successfully, but these errors were encountered: