Skip to content

Commit

Permalink
Attach exact cause in RuntimeException raised (#29470)
Browse files Browse the repository at this point in the history
  • Loading branch information
Abacn authored Nov 22, 2023
1 parent 23b1fe9 commit 9ee6a01
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -765,17 +765,17 @@ long flush(
+ failedContext.offset);
}

boolean streamDoesNotExist =
boolean hasPersistentErrors =
failedContext.getError() instanceof Exceptions.StreamFinalizedException
|| statusCode.equals(Status.Code.INVALID_ARGUMENT)
|| statusCode.equals(Status.Code.NOT_FOUND)
|| statusCode.equals(Status.Code.FAILED_PRECONDITION);
if (streamDoesNotExist) {
if (hasPersistentErrors) {
throw new RuntimeException(
"Append to stream "
+ this.streamName
+ " failed with stream "
+ "doesn't exist");
String.format(
"Append to stream %s failed with Status Code %s. The stream may not exist.",
this.streamName, statusCode),
error);
}
// TODO: Only do this on explicit NOT_FOUND errors once BigQuery reliably produces
// them.
Expand Down

0 comments on commit 9ee6a01

Please sign in to comment.