From 77952f2ccafa7a9be355bf14f4ffe22447afafd8 Mon Sep 17 00:00:00 2001 From: Jason Salaber Date: Tue, 12 Nov 2024 10:32:42 -0500 Subject: [PATCH] fix: wrapped throwable function in a try catch --- .../com/devcycle/sdk/android/eventsource/EventSource.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) {