Skip to content

Commit 7703ab2

Browse files
pschnayder: Updating the StreamWriterClosedException to include client 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
1 parent e4ec6f4 commit 7703ab2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/ConnectionWorker.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,11 +585,21 @@ private ApiFuture<AppendRowsResponse> appendInternal(
585585
}
586586

587587
if (connectionFinalStatus != null) {
588+
String connectionFinalStatusString;
589+
if (connectionFinalStatus
590+
.toString()
591+
.contains("com.google.api.gax.rpc.UnavailableException")) {
592+
connectionFinalStatusString =
593+
connectionFinalStatus.toString()
594+
+ ". This is a most likely a transient condition and may be corrected by retrying"
595+
+ " with a backoff.";
596+
} else {
597+
connectionFinalStatusString = connectionFinalStatus.toString();
598+
}
588599
requestWrapper.appendResult.setException(
589600
new Exceptions.StreamWriterClosedException(
590601
Status.fromCode(Status.Code.FAILED_PRECONDITION)
591-
.withDescription(
592-
"Connection is closed due to " + connectionFinalStatus.toString()),
602+
.withDescription("Connection is closed due to " + connectionFinalStatusString),
593603
streamName,
594604
writerId));
595605
return requestWrapper.appendResult;

0 commit comments

Comments
 (0)