From 19ce72f49decee71c24bcebfbc75014568d22771 Mon Sep 17 00:00:00 2001 From: Igor Bernstein Date: Sun, 3 Nov 2024 19:46:49 -0500 Subject: [PATCH] chore: improve logging in safe response observer Change-Id: I6b36da4824fee7c534bab4c3667332de2b678b4f --- .../cloud/bigtable/data/v2/stub/SafeResponseObserver.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SafeResponseObserver.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SafeResponseObserver.java index 7c65bdf95a..0133dd3c2b 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SafeResponseObserver.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/SafeResponseObserver.java @@ -83,7 +83,7 @@ public final void onResponse(ResponseT response) { @Override public final void onError(Throwable throwable) { if (!isClosed.compareAndSet(false, true)) { - logException("Received error after the stream is closed"); + logException("Received error after the stream is closed", throwable); return; } @@ -113,6 +113,10 @@ private void logException(String message) { LOGGER.log(Level.WARNING, message, new IllegalStateException(message)); } + private void logException(String message, Throwable cause) { + LOGGER.log(Level.WARNING, message, new IllegalStateException(message, cause)); + } + protected abstract void onStartImpl(StreamController streamController); protected abstract void onResponseImpl(ResponseT response);