diff --git a/android-client-sdk/src/main/java/com/devcycle/sdk/android/eventsource/EventSource.java b/android-client-sdk/src/main/java/com/devcycle/sdk/android/eventsource/EventSource.java index bada81c..e432ecc 100644 --- a/android-client-sdk/src/main/java/com/devcycle/sdk/android/eventsource/EventSource.java +++ b/android-client-sdk/src/main/java/com/devcycle/sdk/android/eventsource/EventSource.java @@ -277,7 +277,12 @@ public boolean awaitClosed(final long timeout) throws InterruptedException { private void closeCurrentStream(ReadyState previousState) { if (previousState == ReadyState.OPEN) { - handler.onClosed(); + try { + handler.onClosed(); + } catch (Exception e) { + DevCycleLogger.w("Message handler threw an exception: " + e.toString()); + handler.onError(e); + } } if (call != null) {