Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pschnayder: Updating the StreamWriterClosedException to include client side mitigation suggestions from the public documentation #2784

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,21 @@ private ApiFuture<AppendRowsResponse> appendInternal(
}

if (connectionFinalStatus != null) {
String connectionFinalStatusString;
if (connectionFinalStatus
.toString()
.contains("com.google.api.gax.rpc.UnavailableException")) {
connectionFinalStatusString =
connectionFinalStatus.toString()
+ ". This is a most likely a transient condition and may be corrected by retrying"
+ " with a backoff.";
} else {
connectionFinalStatusString = connectionFinalStatus.toString();
}
requestWrapper.appendResult.setException(
new Exceptions.StreamWriterClosedException(
Status.fromCode(Status.Code.FAILED_PRECONDITION)
.withDescription(
"Connection is closed due to " + connectionFinalStatus.toString()),
.withDescription("Connection is closed due to " + connectionFinalStatusString),
streamName,
writerId));
return requestWrapper.appendResult;
Expand Down
Loading