Skip to content

Commit

Permalink
pschnayder: Updating the StreamWriterClosedException to include clien…
Browse files Browse the repository at this point in the history
…t side mitigation suggestions from the public documentation (#2784)

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

* Adding a period before the updated error message
  • Loading branch information
Philipendulum authored Dec 3, 2024
1 parent e4ec6f4 commit 7703ab2
Showing 1 changed file with 12 additions and 2 deletions.
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

0 comments on commit 7703ab2

Please sign in to comment.